lua-users home
lua-l archive

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

----- Original Message -----
From: Oliver Schmidt
Date: 2/4/2010 4:15 PM
On Thursday 04 February 2010, Philipp Janda wrote:
Why are you doing that? You don't get deterministic cleanup of Lua
values anyway, and IIRC, the stack slots are removed when the function
But if the C++ function does not return soon? If the C++ function does use a
lot of (temporary) C++ objects representing Lua variables (e.g. inside
a C++ loop body) and does call other C++ functions that are also using slots
on the stack, the stack might get full of unused stack slots.
LuaPlus ( lets you hold onto a Lua object within a C++ object:

LuaObject myDataObj = state->GetGlobal("MyData");
LuaObject valueObj = myDataObj["Value"];

The Lua data is stored within the LuaObject itself and does not need the Lua stack.