lua-users home
lua-l archive

What is 'light' user data?

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


Hi Lua ML!
I'm confused about the terminology: What is 'light' user data? Is is
something special? If I write a C function which pops an (in C defined
element) from the stack and creates a copy, should I push the result
of the copy operation as light user data?
 Code example:
 static int config_member_copy(lua_State *L) {
 struct config_member_t *mem;
 struct config_member_t *copy;
 mem = lua_touserdata(L, 1);
 lua_pop(L, 1);
 copy = some_magic_copy_function(mem);
 lua_pushlightuserdata(L, copy);
 return 1
 }
Is this piece of code the correct approach?
-- 
Mit freundlichen Grüßen,
Kind regards,
Matthias Beyer
Proudly sent with mutt.
Happily signed with gnupg.

Attachment: pgp7s6ClD2I5X.pgp
Description: PGP signature


AltStyle によって変換されたページ (->オリジナル) /