Sign in to follow this  

More Luabind object fun

This topic is 2435 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This code works as expected:
[code] void Interpreter::PushObject(Object* o)
{
luabind::object lo = luabind::object(L,o);
lo.push(L);
//lo = luabind::object(L,-1);
Object* test = luabind::object_cast<Object*>(lo);
if (o != test)
{
Notify("Doesn't match!");
}
}[/code]

This code crashes with an error message:
[code] void Interpreter::PushObject(Object* o)
{
luabind::object lo = luabind::object(L,o);
lo.push(L);
lo = luabind::object(L,-1);
Object* test = luabind::object_cast<Object*>(lo);
if (o != test)
{
Notify("Doesn't match!");
}
}[/code]

[quote]"Unhandled exception at 0x7c812afb in LE3.exe: Microsoft C++ exception: luabind::cast_failed at memory location 0x0012f724.."[/quote]

Share this post


Link to post
Share on other sites
Why do I always solve my own questions right after I ask them? :D:
[code] void Interpreter::PushObject(Object* o)
{
luabind::object lo = luabind::object(L,o);
lo.push(L);
lo = luabind::object(luabind::from_stack(L,-1));
Object* test = luabind::object_cast<Object*>(lo);
if (o != test)
{
Notify("Doesn't match!");
}
}[/code]

Share this post


Link to post
Share on other sites
Sign in to follow this