Skip to content

Instantly share code, notes, and snippets.

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 DenisBelmondo/c018c1c1df7030d083f47b336e58ebff to your computer and use it in GitHub Desktop.
Save DenisBelmondo/c018c1c1df7030d083f47b336e58ebff to your computer and use it in GitHub Desktop.
Lua C++ style classes syntax hack
function class(name)
local penis = {
public = function(_, super_name)
return function(body)
print(body)
end
end
}
setmetatable(penis, {
__call = function(body)
print(body)
end
})
return penis
end
-- these are syntactically correct statements:
class 'SuperClass' {
}
class 'SubClass' : public 'SuperClass' {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment