summaryrefslogtreecommitdiff
path: root/src/script/lua.rs
diff options
context:
space:
mode:
authorMica White <botahamec@outlook.com>2026-10-26 10:51:49 -0400
committerMica White <botahamec@outlook.com>2026-10-26 10:51:49 -0400
commit0c128e472b1b49e32c313874eaeccc8c5f1b1202 (patch)
tree2ce06455440e85ec3387f7348b7bd69bf2119634 /src/script/lua.rs
parentc687e2aba30ca231b03288108b632f1bad464028 (diff)
Finish engineHEADmain
Diffstat (limited to 'src/script/lua.rs')
-rw-r--r--src/script/lua.rs67
1 files changed, 1 insertions, 66 deletions
diff --git a/src/script/lua.rs b/src/script/lua.rs
index a5c7f6a..92d455d 100644
--- a/src/script/lua.rs
+++ b/src/script/lua.rs
@@ -50,12 +50,7 @@ impl LuaModule {
warn,
error,
exit,
- is_scene_loaded,
- preload_scene,
switch_scene,
- is_script_loaded,
- preload_script,
- unload_script,
activate_script,
deactivate_script,
state,
@@ -246,29 +241,6 @@ fn exit(lua: &Lua, _: ()) -> mlua::Result<()> {
Ok(())
}
-fn is_scene_loaded(lua: &Lua, scene: String) -> mlua::Result<()> {
- puffin::profile_function!();
- let context = unsafe { context(lua) };
- let scene = scene_id_by_name(&context.manifest.scenes, &scene)
- .ok_or(mlua::Error::runtime("No scene with the given name found"))?;
- crate::scene::is_scene_loaded(
- &context.manifest.scenes,
- context.scripts,
- &context.files,
- scene,
- );
- Ok(())
-}
-
-fn preload_scene(lua: &Lua, scene: String) -> mlua::Result<()> {
- puffin::profile_function!();
- let context = unsafe { context(lua) };
- let scene = scene_id_by_name(&context.manifest.scenes, &scene)
- .ok_or(mlua::Error::runtime("No scene with the given name found"))?;
- context.operation_queue.push(Operation::PreloadScene(scene));
- Ok(())
-}
-
fn switch_scene(lua: &Lua, scene: String) -> mlua::Result<()> {
puffin::profile_function!();
let context = unsafe { context(lua) };
@@ -278,43 +250,6 @@ fn switch_scene(lua: &Lua, scene: String) -> mlua::Result<()> {
Ok(())
}
-fn is_script_loaded(lua: &Lua, script: String) -> mlua::Result<()> {
- puffin::profile_function!();
- let context = unsafe { context(lua) };
- let script = context
- .scripts
- .script_id_by_name(&script)
- .ok_or(mlua::Error::runtime("No script with the given name found"))?;
- context.scripts.is_script_loaded(script, &context.files);
- Ok(())
-}
-
-fn preload_script(lua: &Lua, script: String) -> mlua::Result<()> {
- puffin::profile_function!();
- let context = unsafe { context(lua) };
- let script = context
- .scripts
- .script_id_by_name(&script)
- .ok_or(mlua::Error::runtime("No script with the given name found"))?;
- context
- .operation_queue
- .push(Operation::PreloadScript(script));
- Ok(())
-}
-
-fn unload_script(lua: &Lua, script: String) -> mlua::Result<()> {
- puffin::profile_function!();
- let context = unsafe { context(lua) };
- let script = context
- .scripts
- .script_id_by_name(&script)
- .ok_or(mlua::Error::runtime("No script with the given name found"))?;
- context
- .operation_queue
- .push(Operation::UnloadScript(script));
- Ok(())
-}
-
fn activate_script(lua: &Lua, script: String) -> mlua::Result<()> {
puffin::profile_function!();
let context = unsafe { context(lua) };
@@ -436,7 +371,7 @@ fn storage(lua: &Lua, default: MyLuaValue) -> mlua::Result<MyLuaValue> {
let context = unsafe { context(lua) };
Ok(context
.storage
- .get()
+ .data()
.map(|state| postcard::from_bytes(state).unwrap())
.unwrap_or(default))
}