lua-users home
lua-l archive

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

Здравствуйте, Viacheslav.

Вы писали 20 октября 2015 г., 18:28:28:

> When embedding Lua into an application written in C++, it is pretty
> much a requirement to compile the Lua library in the C++ mode, to
> ensure that Lua's error mechanism interoperates properly with C++'s
> destructors. Lua supports being compiled as C++, and once the
> compiler is instructed to compile the code as C++, it will
> automatically use throw/try/catch.

You can build Lua as C library and use lua_pcall.
So  you  create C function which did not have any C++ object in stack.
This function interact with Lua API.
And you can call this function from C++ function using lua_pcall.
You can pass any C++ objects as pointer via upvalues.
Of  course you have chance get error on lua_push***. But I just ignore

С уважением,

Это сообщение проверено на вирусы антивирусом Avast.