lua-users home
lua-l archive

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


=== FAQ ===

Robert Kücken wrote:
how can I pass structures from C to Lua? I tried it with the function lua_pushlightuserdata, but it's only the pointer, what the lua-script gets. So how I can access the elements of the structure?

Hi Robert,

The easy way is to use Waldemar's tolua:
http://lua-users.org/lists/lua-l/2003-08/msg00188.html

If you are a C++ guy, you may like luabind:
http://luabind.sourceforge.net/

For more info, see the wiki:
http://lua-users.org/wiki/BindingCodeToLua
http://lua-users.org/wiki/LuaAddons

If you would like to write the binding yourself, have a look at:
http://lua-users.org/lists/lua-l/2003-07/msg00265.html
http://lua-users.org/lists/lua-l/2003-07/msg00357.html

There are also complete examples on the wiki.

- Peter