Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function eat(food)
print ("I eat " .. food)
end
function drink(food)
print ("I drink " .. food)
end
function swallow (food)
func = {[true] = eat,
[food == "juice"] = drink}
func[true](food)
end
swallow("juice")
swallow("apples")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment