Skip to content

Instantly share code, notes, and snippets.

View BruAPAHE's full-sized avatar
🐓
Golang beast

BruAPAHE

🐓
Golang beast
View GitHub Profile
@picsoung
picsoung / switch.lua
Created August 3, 2015 11:04
a switch in Lua
-- fct to simulate a switch
function switch(t)
t.case = function (self,x)
local f=self[x] or self.default
if f then
if type(f)=="function" then
f(x,self)
else
error("case "..tostring(x).." not a function")
end