lua-users home
lua-l archive

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


>From my understanding of the Lua spec, from the perspective of the C program 
that Lua is embedded in, userdata items are of type void*.

In my application it would be more convenient if the userdata was an int, 
rather than the address of a memory location. Clearly my C program will never 
attempt to dereference the int as if it was a void*. However could the current 
lua interpreter, or a lua program running in the interpreter, ever perform an 
action (such as dereference, free, realloc, etc...) on a userdata with the 
expectation that it is a pointer to a valid memory location?

Secondly, if it is safe to provide userdata values which are not pointers to a 
valid area of memory, then is this safety guaranteed by the specification, so 
I can likely expect this to work with future versions.

Thank you,
Steven Murdoch.