lua-users home
lua-l archive

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


2011/1/15 Mike Pall <mikelu-1101@mike.de>:
> 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
> generation.

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.
Cool!