lua-users home
lua-l archive

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


Hello Enrico,

EC> Lothar Scholz wrote:
>> This is a newbies question: If i create multiple userdata objects,
>> what the best way to find out if that userdata pointer that i get from
>> the stack belongs to my "Foobar" c struct.

EC> A fast way could be packing an integer id together with the pointer in
EC> the userdata object (not a light userdata, which is just a pointer if I
EC> remember correctly).

What if somebody has this done in a library?

I can't access the userdata in any way before i'm not sure that it is
mine. Maybe somebody passed in a userdata of size 0 (possible?), so that
check would crash the app.


-- 
 Best regards,                        emailto: scholz at scriptolutions dot com
 Lothar Scholz                        http://www.ruby-ide.com
 CTO Scriptolutions                   Ruby, PHP, Python IDE 's