Skip to content

Instantly share code, notes, and snippets.

@cheald
Created October 6, 2012 21:07
Show Gist options
  • Save cheald/3846132 to your computer and use it in GitHub Desktop.
Save cheald/3846132 to your computer and use it in GitHub Desktop.
local foo = {}
function foo:Bar(text)
-- `self` is foo, `text` is the passed in parameter
end
foo.Bar(foo, "text")
foo:Bar("text")
local otherFoo = {}
-- In this invocation, "self" will be otherFoo in the method
foo.Bar(otherFoo, "text")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment