Multi-line function tables in lua
I cannot find any other online help for creating a table containing multi-line functions. For example, here's a snippet of code from the wiki wiki.
action = {
[1] = function (x) print(1) end,
[2] = function (x) z = 5 end,
["nop"] = function (x) print(math.random()) end,
["my name"] = function (x) print("fred") end,
}
I want to do something like this:
action = {
[1] = function blah()
more code here
end
[2] = function blahblah()
more code here
end
}
So how can I do this?
+3
source to share