lua-users home
lua-l archive

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

> Is there a better way? In other words, can I push the userdata on
> the stack given only the pointer to that userdata? That would be
> nnnnnice.

There is a simpler solution, but not that simpler. You can keep a
map from light userdata (the pointer to the userdata) to the
userdata themselves.

Nevertheless, this map still must be kept in a weak table if you want
Lua to colect the userdata. (But that seems dangerous if other parts of
your code keep a pointer to it.)

-- Roberto