Sign in to follow this  
JoshKlint_34394

More Luabind object fun

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this