lua-users home
lua-l archive

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


I've just started integrating Lua with our app, and I've got a few
questions.

I want to use ToLua to expose my C++ classes over to LUA.  What is the
recommended way to expose your applications interface to Lua?? While
it's very appealing to use ToLua inorder to expose my existing
interfaces, I'm worried that my existing headers may have a high number
of dependencies for it to be properly dealt with.

For example.

in myheader.h

it includes -

myTypes.h
myHelperClass.h
myMathStuff.h


-- While in the C class the number of dependies of this high level
class is reasonable. I'm afraid running this through ToLua would expose
several hundred more functions than needed.

The only two solutions I can think of is to either create a separate
lua interface class which _only_ exposes the functions I want exposed
and avoids including outside header files.  The problem is that there
would be an additional function call overhead for every Lua to C
function call.

Lua -> LuaWrapper_Function ->  Actually C function call.
Plus i'd have to maintain a Wrapper every time the actually function
symantics change.  Which may not be a bad thing since I could hide
function call changes from the different LUA scripts.

The other solution is to do all the function mappings manually without
ToLua. But i'm a lazy programmer and would like to avoid typing all
that in. =)

Are there performance considerations for the number of C/C++ functions
you make available to LUA?

Performance and maintainability is a large consideration.

Thanks for any insights.

Thomas