Going crazy already...
Any idea why this doesn't work?
devIP="X.X.X.X"
devPort="XXX"
commandArray={}
if os.execute('nc -n -w 1 ".. devIP.." ".. devPort .. "') and...
While this works just fine?
commandArray={}
if os.execute('nc -n -w 1 X.X.X.X XXX') and...
Can't figure out what the issue is.
Lua concatenation
Moderator: leecollings
Lua concatenation
Last edited by tequila on Tuesday 13 September 2016 18:21, edited 1 time in total.
-
- Posts: 722
- Joined: Friday 02 October 2015 12:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Finland
- Contact:
Re: Lua concatenation
Something like this:
if os.execute('nc -n -w 1 '..devIP..' '..devPort) and...
?
to see how lua / domoticz interprets it you can also add:
print('nc -n -w 1 '..devIP..' '..devPort)
and check the log to see if the printed command makes any sense
if os.execute('nc -n -w 1 '..devIP..' '..devPort) and...
?
to see how lua / domoticz interprets it you can also add:
print('nc -n -w 1 '..devIP..' '..devPort)
and check the log to see if the printed command makes any sense

Re: Lua concatenation
I actually did print the command and it looks as expected in the log.
I tried to play with single and double quotes too, but still no luck.
I tried to play with single and double quotes too, but still no luck.
-
- Posts: 722
- Joined: Friday 02 October 2015 12:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Finland
- Contact:
Re: Lua concatenation
Hmm, strange. In the first example of yours, I don't think you can add a variable as part of the command and use a different type of quote than the one with which the command begins. So when you start with single, then you need to use single to tell the interpreter that text ends there and a variable comes next (with ..). Again same should be applied to continuing with text again. Inside the single quotes you could have the double quotes as well 8and they'd print as part of the command), but in this case not needed.
Re: Lua concatenation
tried once again and this seems to finally work:
devIP='X.X.X.X'
devPort='XXX'
commandArray={}
if os.execute("nc -n -w 1 ".. devIP.." ".. devPort .. "") and...
devIP='X.X.X.X'
devPort='XXX'
commandArray={}
if os.execute("nc -n -w 1 ".. devIP.." ".. devPort .. "") and...
-
- Posts: 722
- Joined: Friday 02 October 2015 12:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Finland
- Contact:
Re: Lua concatenation
Good that it workstequila wrote:tried once again and this seems to finally work:
devIP='X.X.X.X'
devPort='XXX'
commandArray={}
if os.execute("nc -n -w 1 ".. devIP.." ".. devPort .. "") and...

Code: Select all
os.execute('nc -n -w 1 '..devIP..' '..devPort) and...

Re: Lua concatenation
haha, thanks for all the advices my friend. those quotes are quite confusing for me so I am glad it works now.
Who is online
Users browsing this forum: No registered users and 1 guest