a={ {print("Hello")}, {print("I don't like you")} } b=a[1]LUA manual says that the proper syntax is
do block endbut when i replace block with a variable it doesn't work. So, how to execute blocks?
Posted 22 February 2012 - 07:21 PM
a={ {print("Hello")}, {print("I don't like you")} } b=a[1]LUA manual says that the proper syntax is
do block endbut when i replace block with a variable it doesn't work. So, how to execute blocks?
Posted 22 February 2012 - 07:31 PM
Posted 22 February 2012 - 07:55 PM
Posted 22 February 2012 - 08:05 PM
local a = { function() print("Hello") end, function() print("I don't like you") end }
b = a[1] b()... or you can even call it directly from the table by adding the "function brackets" directly after it:
a[1]()
function printHello() print("Hello") end function stateOpinion() print("I don't like you") end local a = { printHello, stateOpinion }
Posted 22 February 2012 - 08:47 PM
0 members, 1 guests, 0 anonymous users