Jump to content
  • Advertisement
Sign in to follow this  
JoshKlint_34394

More Luabind object fun

This topic is 2616 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:
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!");
}
}


This code crashes with an error message:
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!");
}
}


"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
Advertisement
Why do I always solve my own questions right after I ask them? :D:
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!");
}
}

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!