lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Hi, if I wanted to modify lua to catch every creation of a complex data type
> (anything other than nil, number, boolean, string) so that I can assign a
> uid to it, would the right place be the set*value macros in lobject.h?

In Lua 5.2, the allocation function passed to lua_newstate should be
able to trigger this.
You do not even to modify anything in Lua !
When Lua wants to allocate a new chunk, it calls that function with
ptr = NULL and osize is an *enumeration* value telling the type of the
object [1].
In Lua 5.1, osize was always 0 when ptr = NULL.

[1] http://www.lua.org/manual/5.2/manual.html#lua_Alloc