Couple of changes in preparation for 'm' safety:

- auto formatting
- add gc control to ffi
- add gc_guard to util functions
- use gc_guard to make util error handling functions never trigger __gc
  metamethod Lua errors even without __gc metatable wrapper
- sort of a technicality, don't call luaL_requiref outside of the Lua
  constructor, as it could trigger the garbage collector when user code has had
  a chance to set __gc metamethods.  Changes the API to load the debug table.
This commit is contained in:
kyren
2017-12-03 23:01:03 -05:00
parent 0bd676aa81
commit 67e8907f19
5 changed files with 285 additions and 239 deletions
+2 -6
View File
@@ -15,12 +15,8 @@ fn test_load() {
}
#[test]
fn test_load_debug() {
let lua = Lua::new();
lua.exec::<()>("assert(debug == nil)", None).unwrap();
unsafe {
lua.load_debug();
}
fn test_debug() {
let lua = unsafe { Lua::new_with_debug() };
match lua.eval("debug", None).unwrap() {
Value::Table(_) => {}
val => panic!("Expected table for debug library, got {:#?}", val),