[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Convert userdata to hex string
- From: Peter Cawley <lua@...>
- Date: Sat, 20 Feb 2010 21:58:35 +0000
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.