Skip to content

Commit

Permalink
fixed default.lua getting loaded twice
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhan45 committed Jun 18, 2020
1 parent 1ada26f commit 8d02382
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
2 changes: 1 addition & 1 deletion saved_systems/default.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_bodies(
{x = 150.000, y = 100.000, x_vel = 0.000, y_vel = 0.000, mass = 75.000, rad = 5.000},
{x = 215.000, y = 100.000, x_vel = 0.000, y_vel = -1.550, mass = 0.010, rad = 0.800}
{x = 215.000, y = 100.000, x_vel = 0.000, y_vel = -1.100, mass = 0.010, rad = 0.800}
)
13 changes: 1 addition & 12 deletions src/main_state/lua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,9 @@ impl MainState<'_, '_> {
)
.exec()
.unwrap();

if let Ok(lua_init_code) = std::fs::read_to_string("saved_systems/default.lua") {
if let Err(e) = lua_ctx
.load(&lua_init_code)
.set_name("default.lua")
.unwrap()
.exec()
{
println!("Lua {}", e.to_string());
};
}
});

self.process_lua_bodies();
let _ = crate::saveload::load_from_lua(&self.world, "saved_systems/default.lua".to_string());
}

pub fn lua_update(&mut self) {
Expand Down

0 comments on commit 8d02382

Please sign in to comment.