This might interest you:
http://metalua.luaforge.net/samples/olua.lua.htmlIt's a Metalua module that adds a class syntax. It can be significantly simplified, and the implementation model of the classes can be changed as suits you best. It currently allows to write things like:
---------------------------------------------
-- Import the syntax extension
-{ dofile "olua.luac" } -{ olua_init }
class root
field x = 0
method init (n)
-- constructors are all called "init"
if n then self.x = n end
end
method f ()
self.x = self.x + 1
print (self.x)
end
end
class leaf < root
field x, y = 100, 42
end
-- Simple test for constructors and basic inheritance
function test()
r = root(10)
for i=1, 10 do
r:f()
end
l = leaf()
for i=1, 10 do
l:f()
end
end
A much simpler and better designed version will hopefully ship with Metalua alpha 0.2