lua-users home
lua-l archive

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


Luis Carvalho wrote:
> 
> The simplest way I found to allow correct indexing was to build a
> struct with a pointer to Udata (from lobject.h) and to provide a small
> extension to the API so that full userdatas could be pushed to the
> virtual stack. I know it's a bit overkill, but it worked like a charm.
> :)

Afaics, it's totally unnecessary.  Every userdata you push via
pushrawuserdata has a luaL_ref.  Just use it to push the userdata
back onto the stack: lua_rawgeti(L, LUA_REGISTRYINDEX, matrix->ref).
Then you can also remove all the udata<->matrix conversions;  use
Matrix-ptrs everywhere.

Ciao, ET.