[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua Code Integration with C++
- From: "Thiago 'HellRaider' Bastos" <hellraider@...>
- Date: Tue, 08 Oct 2002 21:27:39 -0300
> I am a new user of Lua.
>I need to integrate code of Lua with C++.
>With C it is easy , just 'extern C'.
>Is there similar mechanism for Lua too,
>so that you can call C++ procedures from Lua
You can use lua_register() to export C++ functions just like you do with C
If you want to export C++ classes and/or objects to Lua, however, you must
use a different approach.
Take a look at Lenny Palozzi's paper on binding C++ classes to lua:
And his template class implementation:
It's written for Lua 4.0 and needs some tweaks to work properly with Lua 5.0
To call Lua functions from C/C++ you must use lua_call/lua_pcall, if I
remember. This is a real 'RTFM' question.