I know Lua does not have a case statement, so I tried looking up something that would be similar and I found this site: http://lua-users.org/wiki/SwitchStatement , and I tried looking at the examples but there's a few things I don't quite understand.
What does the switch = switch or {a = "aah", b = bee, c = "see", ..., z = "zee"} line do? How does whether to do one, -or- the other?
do
local switch
function sayit(letters)
for _,v in ipairs{sayit} do
switch = switch or {a = "aah", b = bee, c = "see", ..., z = "zee"}
local s = switch[v] or "what?"
print(s)
end
end
end
sayit{'h','e','l','l','o','?'}What does the switch = switch or {a = "aah", b = bee, c = "see", ..., z = "zee"} line do? How does whether to do one, -or- the other?