decimad / luabind-deboostified

Create Lua bindings for your C++ code easily - my improvements
http://www.vrac.iastate.edu/vancegroup/docs/luabind/
Other
71 stars 26 forks source link

Fixed function calling and updated error handling mechanisms #12

Closed ltjax closed 9 years ago

ltjax commented 9 years ago

Sending my changes as a pull request, as requested by decimad.

I mostly fixed the function calling mechanism, where calling with l-value parameters would not work. Also, the order of the function parameters now works - it relied on undefined behavior before.

The more disruptive change, however, is the change in the error-handling mechanism. In the original design, when a lua error was translated into a luabind exception, the error message was supposed to be on the stack, and the caller catching it was supposed to pop it from there. However, this does not really work, since luabind itself modifies the stack while an exception is in flight (see index_proxy). The upside to the old approach was that the copy constructor of the exception could not throw - it can now, though this can be circumvented if this is ever needed.

I also changed the way you set up the pcall error handler to make it easier to use the built-in lua functions. This is another API break, but it can easily be fixed in client code with a small wrapper function.

decimad commented 9 years ago

Thank you, ltjax!