Project

General

Profile

Extending the Lua Interface

Exposing new C++ methods to Lua

The pkg files responsible for exposing methods to Lua reside in the LuaInterface directory of the engine source tree.

First, check for a pkg file name matching the name of the header file where the new method(s) is defined. If one already exists then simply add the new method declarations, otherwise create a new pkg file and add the method declarations you wish to expose. Look at other pkg files for reference.

If a new pkg file was added, edit the LuaInterface.pkg file to reflect the new addition.

Perform a fresh top level build. That’s it! The build will automatically invoke tolua++ to generate the new interface source files.

make clean && make copypkg && make lua && make -j4 && make install && NightshadeNG