Replies: 12 comments 1 reply
-
|
Beta Was this translation helpful? Give feedback.
-
Thanks for replying. I know what |
Beta Was this translation helpful? Give feedback.
-
FWIW: For the moment, I silenced the warning thusly: luabridge::Stack<CMPER>::push(l, returnVal.first) LB3(.operator bool());
The |
Beta Was this translation helpful? Give feedback.
-
pushing on the stack can fail for multiple reasons and it's always safer to handle the case, you'll save yourself from additional grey hairs. |
Beta Was this translation helpful? Give feedback.
-
Regarding non intrusive shared refcounting, luabridge |
Beta Was this translation helpful? Give feedback.
-
stack pushingI would be interested in seeing the coding pattern for stack pushing that for you is optimal. If it involves an ugly sequence of if statements, I will push back with the observation that this is why we have non-intrusive lifetime sharingSurely you agree that the library is of much more limited value if there is no way to have shared lifetime on a class without modifying it. (It would present a formidable barrier to using the library for my project, for example.) That said, I am not particularly in love with I am just brainstorming, but I'm wondering if it would be possible to re-implement using LuaBridge in a ClibOne of the big problems with the current implementation of But this problem extends more fundamentally into LuaBridge. A Clib cannot safely register classes, either, at least not on LB2. They work just fine, but then the program crashes when the Lua state closes. I'm guessing there must be a hidden global somewhere, but I haven't ever bothered to go looking for it. |
Beta Was this translation helpful? Give feedback.
-
Safety is the principle i'm adhering the library on, by relying on // You dont' care ? then simply don't care
template <class T>
void push(lua_State* L, T&& value)
{
(void) luabridge::push(L, value);
}
// You care but you need exceptions ? throw
template <class T>
void push(lua_State* L, T&& value)
{
if (auto result = luabridge::push(L, value); not result)
throw std::runtime_error(result.message());
}
// I can't use neither of the two. I care about safety but couldn't run with exceptions. Moreover |
Beta Was this translation helpful? Give feedback.
-
I'm using How about adding a method to luabridge::push(L, value).throw_on_error(); Or something like that. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Sound like a great idea, will look into a proposal |
Beta Was this translation helpful? Give feedback.
-
Are comments about |
Beta Was this translation helpful? Give feedback.
-
Old one is broken, new one is incomplete as you cannot recover the reference count back safely into C++ land from lua. |
Beta Was this translation helpful? Give feedback.
-
I took a stab at migrating my project from LuaBridge2 to LuaBridge3. I ran into a couple of roadblocks:
std::shared_ptr
, but it is not, in fact, non-intrusive. Per the manual, each such class has to derivestd::enable_shared_from_this
, unless I am missing something. Is there any reason I can't useRefCountedPtr
from LuaBridge2? It seems like it should work without any changes.Namespace::addCFunction
appears to be missing. (Or at least that's the error message I'm getting.)luabridge::Stack<bool>::push(L, returnVal);
What should I be doing with the return value? Or is there a more proper way to push values?
Beta Was this translation helpful? Give feedback.
All reactions