lua-users home
lua-l archive

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

Jerome Vuarand wrote:
> The point is that I was able (without being backed by "any C
> standard") to store integer constants and values that do not fit a
> double in the 64bits win32 ABI (e.g. INVALID_SOCKET, TVI_FIRST) in a
> Lua light userdata. To be compatible with LuaJIT2 I'll have to put
> these objects in a full userdata, and make sure my lua_toUINT_PTR
> accept these.

It's your choice if you want to (ab)use lightuserdata for that
purpose. But now you have full knowledge that this is violating
basic portability assumptions. So don't blame it on me or LuaJIT.

> Assuming I properly understood what you explain, a size_t can contain
> a void*, but not the contrary. With that in mind I'd rather have
> lua_pushlightuserdata take a size_t than a void*. But obviously that
> would break your value packing model, so I guess I can't have a fully
> satisfactory solution.

lua_pushlightuserdata is a standard Lua API function. It's not
within my power to redefine that. And I certainly wouldn't
recommend to do that, anyway.