lua-users home
lua-l archive

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


Michael Mzik wrote:
[snip]

Although there are good documentation resources around, I would like to ask two beginner-questions:

- what is the best way to use Lua from C++ (Wrappers, exception-handling, etc)?


I personally write my own wrappers, but if the amount of existing code you need to interface is huge, this may not be an option.

You can take a look here:
http://lua-users.org/wiki/BindingCodeToLua

for a few pointers.

> -          and how may I intercept “exit”-statements in Lua-Script in
> C++ to prevent my whole application from closing?
>

What do you mean by "exit" statements?
Does your scripts call functions like os.exit and the like? If so, you can simply replace the offending functions with empty ones before calling those scripts, either with Lua:
  os.exit = function() end

or with C.


Regards,
Ignacio Burgueño