[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: 5.2 'classes' without LUA_COMPAT_MODULE
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 10 Jul 2012 18:29:42 -0300
> I'm upgrading to Lua 5.2.1 from 5.1.4 and am having difficulty finding examples on how one defines 'classes' in 5.2 without using LUA_COMPAT_MODULE.
See my libraries at
http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/
lbc and lrandom should be easy enough to understand. Just be aware that
I'm lazy and I use the library table as the metatable for the objects it
creates.
> luaL_getmetatable(L, test_class_name);
> lua_setmetatable(L, -2);
In Lua 5.2 you can replace those lines by luaL_setmetatable(L,test_class_name).