[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: What is 'light' user data?
- From: Matthias Beyer <mail@...>
- Date: Mon, 23 Sep 2013 16:03:05 +0200
Okay, forget it. I RTFM!
Sorry for these spammy messages!
But another question, related to this stuff: What is the way how to do
it? Should I work with light user data, when writing a lua binding for
my application? I think, the light user data stuff is much faster,
isn't it? And I want it to be as fast as possible... so, should I use
light user data, or not? And if not, how to do it then?
On 23-09-2013 15:44:18, Matthias Beyer wrote:
> 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.
--
Mit freundlichen Grüßen,
Kind regards,
Matthias Beyer
Proudly sent with mutt.
Happily signed with gnupg.
Attachment:
pgpB5CeWD1Pur.pgp
Description: PGP signature