Skip to content

Instantly share code, notes, and snippets.

@nrk
Created June 20, 2011 06:46
Show Gist options
  • Save nrk/1035222 to your computer and use it in GitHub Desktop.
Save nrk/1035222 to your computer and use it in GitHub Desktop.
Using pcall in Lua
local lol = {
wut = function(self, ...)
error("LOL WUT")
end,
}
-- this would normally be used like: lol:wut(1,2)
local s,e = pcall(lol.wut, lol, 1, 2)
print(s,e) -- false lol.lua:3: LOL WUT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment