Re: Combining tabled strings
Status: Alpha
Brought to you by:
cwalther
|
From: Christian W. <cwa...@gm...> - 2011-11-30 20:50:27
|
James C. Wilson wrote:
> local execute = ""..keypress[1]..""..keypress[2]..""..keypress[3]..
> ""..keypress[4].. ""..keypress[5].. ""..keypress[6].. ""..keypress[7]..
> ""..keypress[8].. ""..keypress[9].. ""..keypress[10].. ""
>
> if execute == "map" then
Works for me. By the way, you don't need all these empty strings - this
works too:
local execute = keypress[1]..keypress[2]..keypress[3]..
keypress[4]..keypress[5]..keypress[6]..keypress[7]..keypress[8]..
keypress[9]..keypress[10]
And if you want to save some typing, or handle variable-sized lists, a
shorter version is
local execute = table.concat(keypress)
(see http://www.lua.org/manual/5.0/manual.html#5.4 )
> I receive an "unexpected symbol near "if" error.
That suggests that there is something wrong with what comes before the
"if" - Lua is not expecting an "if" there, but something that completes
whatever comes before.
-Christian
|