Skip to content

Instantly share code, notes, and snippets.

@joehakimrahme
Created May 9, 2012 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joehakimrahme/2642890 to your computer and use it in GitHub Desktop.
Save joehakimrahme/2642890 to your computer and use it in GitHub Desktop.
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