Page 1 of 1

How can I register my C/C++ functions to LUA script module?

Posted: Mon Oct 30, 2006 05:28
by televoncard
Hi.

I want to write event handling code in lua scripts, so I want to call some C/C++ functions which I wrote. I hope a function which enables me to register my functions to Lua script module, but I coudn't find such functions.

How can I register my C/C++ functions to LUa script module? Or how can I call my functions from LUA scripts?

Posted: Mon Oct 30, 2006 18:29
by lindquist
This is really outside the scope of CEGUI and CEGUILua.

I can really recommend the Lua manual, it's pretty well written and get straight to the point.

Lua Manual : Defining C Functions

For binding the CEGUI API to Lua we use tolua++ to generate bindings. Depending on the amount of code you want to bind to Lua you might want to consider going that route. CEGUI 0.5 has everything you need to (re)generate the CEGUI bindings right in the svn repository. It might be a nice sample/reference for you to get started.
Note that we are using a customised generator with added exception handling attributes.