-
-
Notifications
You must be signed in to change notification settings - Fork 49
Closed
Description
I've cloned the repository locally and tried to run the wrappers example from it with cargo run --example wrappers --features="lua lua54 lua_script_api". I get this result after the initial startup info line
ERROR bevy_mod_scripting_lua: Runtime error in script `script.lua` callback error
stack traceback:
[C]: in field 'make_ref_to_my_resource'
[string "script.lua"]:3: in function 'once'
caused by: error converting Lua nil to userdata
After script run: MyThing {
usize: 420,
string: "I live in the bevy world, you can't touch me!",
}
I've tried this test on both the main branch and the 0.11 branch with the same result
If I read the code correctly, I believe it's supposed to error in the second script run, but not the first. It appears that the issue comes from
fn "make_ref_to_my_resource" => |ctx,()| {
let globals = ctx.globals();
let lua_world : LuaWorld = globals.("world")?; //This lineAI changed it to
let lua_world_o = globals.get("world");
info!("{:#?}",lua_world_o);
let lua_world :LuaWorld = lua_world_o.unwrap();and got
wrappers:
INFO wrappers: Err(
FromLuaConversionError {
from: "nil",
to: "userdata",
message: None,
},
)
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: FromLuaConversionError { from: "nil", to: "userdata", message: None }', examples/wrappers.rs:69:52
)
Getting access to the world like this is really the thing I need most out of the crate right now, so any help would be very appreciated.
Metadata
Metadata
Assignees
Labels
No labels