[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: lua_pushusertag(L,0,my-tag)
- From: mark@...
- Date: Thu, 19 Apr 2001 13:15:48 -0700 (PDT)
Is there an issue using lua_pushusertag with a reserved tag when the
void* to push is 0?
I am getting some odd behaviour. I have a gc method attached to all
user data with a given tag and the user data that should have a 0 value
for the pointer allways comes back with a different value.
I have the following lua code
bounds = anm_boundingrect()
lens = anm_lens
null = anm_call(lens,"getBounds",bounds)
anm_* are functions that I have lua_register'd
I know that my anm_call function is returning 0 in this case, and it is
returning 1 to indicate that there is one return value on the lua stack.
In anm_print lua_gettop is returning 1 (as expected). Then I call
lua_touserdata and I do not get the same value that I pushed in
anm_call, namely 0. Why not?
I have written many other functions thus far and all is behaving as
expected, this is the only problem I have had. But I am a first time
lua user so this is all new to me.
For now I am working around the problem by pushing (void*)-1 when I
really mean 0 and then doing a reverse mapping to 0 from -1 when I
should but this is ... um ... ugly. I haven't found any doc to explain
Thanks for any insights.
All the best,