Re: Type of CDATA as returned by lua_type

  • From: Mike Pall <mike-1403@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Fri, 7 Mar 2014 16:06:07 +0100

Evan Wies wrote:
> On 3/7/14, 4:52 AM, Mike Pall wrote:
> >>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.
>
> I was pondering recently how strict this is.  Does one need to be
> concerned with using opaque stack API functions like lua_pushvalue
> and lua_replace?   What about functions like lua_equal?

lua_* API functions that deal with opaque stack slots are fine.
lua_equal() etc. isn't 100% identical to Lua's '==' etc. I'd
strictly avoid dealing with cdata values from the Lua/C API.

--Mike

Other related posts: