Nimjox
Nimjox

Reputation: 1381

Concating in Lua using ; issue

I can't concate when using a ';'. The following yeilds nothing in the below dump.txt:

returnString = returnString..Data[1]..","..Data[2]..";"

but if I do this, the data is placed inside dump.txt:

returnString = returnString..Data[1]..","..Data[2].."."

This is under Lua 5.2 in an embedded Linux OS. Does anyone know why the first doesn't work? Is this related to something I'm doing wrong from a code perspective or does this point towards an OS issue? I'm using this command to view the variables output:

 os.execute("echo "..returnString.." >>/tmp/dump.txt")

Upvotes: 3

Views: 50

Answers (1)

Mud
Mud

Reputation: 28991

os.execute("echo "..returnString.." >>/tmp/dump.txt")

This translates into the command line:

echo x,y; >> /tmp/dump.txt

Can you see why that wouldn't work?

Upvotes: 5

Related Questions