lua-users home
lua-l archive

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


On Sat, Feb 20, 2010 at 9:54 PM, Peter Smith <psmith135@gmail.com> wrote:
> Could someone please help me how to write a function in base Lua
> 5.1 to print out a userdata variable as a hex string?

As far as base Lua is concerned, userdata are opaque blobs which you
cannot do anything with - you can only store them, pass them to
functions, etc. To get the contents of a userdata, you need to use the
C functions designed specifically for that userdata, which in turn
employ the base C API function lua_touserdata to get memory access to
the userdata.