[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJIT 2 ffi (casting / force hotpath)
- From: CrazyButcher <crazybutcher@...>
- Date: Sun, 16 Jan 2011 00:23:20 +0100
2011/1/15 Mike Pall <email@example.com>:
> Well, you'd need to convert to plain Lua objects then. There's no
> support for creating/accessing cdata objects in the old Lua/C API.
> This will not be needed once I implement automatic callback
independently of you fixing this, I also saw that
ffi.cast("Type*", luaUserData / luaLightUserData)
works, in fact ffi.cast also automatically casts strings to enums or
const char, as well as numbers and so on... nice!
That way one can pass pointers as light user data into Lua from C, and
have the lua function do the proper conversion.
As for returns I saw that "lua_topointer" works well with cdata. Which
means communication works and no need to expose native cdata api.