Re: Type of CDATA as returned by lua_type

  • From: Mike Pall <mike-1403@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Fri, 7 Mar 2014 10:52:30 +0100

Saptarshi Guha wrote:
> I hope i haven't missed this, but does  the C function lua_type return 10
> for cdata objects? Is there #define for this (e.g. like LUA_TCDATA)

Only internally. But, yes, it's guaranteed to be 10 for LuaJIT 2.0.

> Or is there another better way to check whether a lua object is a CDATA.

No, because the classic Lua/C API and the FFI shouldn't be mixed.
Deal with cdata on the Lua side only. Call C functions that need
to be passed cdata only via the FFI.

--Mike

Other related posts: