Advertisement Jump to content
Sign in to follow this  

luabind xpcall?

This topic is 3836 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

Familiar with luabind? It's an incredibly good LUA wrapper! However, I have a problem! Consider this sample code: try { luabind::call_function<void>(pLuaState, "foo", x); } catch (luabind::error &e) { luabind::object error_msg(luabind::from_stack(e.state(), -1)); stringstream ss; ss << error_msg; DisplayError(ss.str()); } The lua-file: function foo(x) return -- Here we get a runtime error! '.' should be ':' end The problem is that the error does not contain information about where the error occurred. In this case, it should say "foo.lua:2 error" but it will only show "error". How do I make sure the file name and line number are valid when such a function call fails? (I've read about the "xpcall", but I can't figure out how to use it with luabind.)

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!