[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Feature request : More lightuserdata types
- From: Flyer31 Test <flyer31@...>
- Date: Tue, 22 Feb 2022 16:12:24 +0100
But if you connect "normal C userdata" to metatables, you can also do
this without library, as e. g. described in Roberto's Programming in
Lua, Caphter 31, "User defined types in C" for this new bitarray type.
Just what you definitely seem to need here is a code in the following form:
luaL_newmetatable(L, "my-metatable-name");
...
lua_newuserdata(L, nbytes);
luaL_getmetatable(L, "my-metatable-name");
lua_setmetatable(L, -2);
... so this would connect the metatable to the userdata element
defined with nbytes Bytes... .
This does NOT need any library functions, this is just standard Lua c code... .
But how would you do this connection in case of lightuserdata element?
(if you might give a short summary, this would be nice ... of course I
could also look at your github code, this sounds interesting, thank
you).