-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redo the debug interface #57
Comments
I would also like an option for lua functions that can cause a lua error to be able to return a lua string somehow. It would be nice to avoid more of this lua.doFile(lua_file_name) catch |err| {
const lua_err = try l.toString(-1);
std.log.err("{s}", .{lua_err});
return err;
}; maybe just a function like this pub fn logAndReturn(err: anyerror) anyerror {
//get the lua error and print it to std err
//...
return err;
}
lua.doFile(lua_file_name) catch |err| return lua.logAndReturn(err); |
BTW another comment regarding handling errors. This might be more of a documentation suggestion. It's now quite possible to wrap a C binding function that returns a Zig error, like so:
If the input argument is not a userdata, the first However, one gets much better error messages if instead you'd do:
OTOH, using something luaL_argerror or lua_error might have some surprising gotchas too. For example, would any Zig Some sort of short guide on how to properly deal with errors in bindings might be a great addition to Ziglua docs. |
After merging #52, most of the combined library code is relatively clean. One area I would like to improve is the debug library.
I am not sure on the how or the what, but this is a reminder to take a look and see if we can build a more "ziggy" interface on top of what Lua provides. Bonus points if it also hides some of the differences between Lua versions
The text was updated successfully, but these errors were encountered: