diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-08-02 00:36:10 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-08-02 00:36:10 +0200 |
| commit | fe0938b1de0c46fc2afcaa3dcd6a0f4ec870d21a (patch) | |
| tree | 8db7509894842395cfb309f00c41b7f4d173888c /src/lua/runtime.rs | |
| parent | 1e1eb95926f556e666bc20355327abd24d264858 (diff) | |
add state which is shared with the lua environment
Diffstat (limited to 'src/lua/runtime.rs')
| -rw-r--r-- | src/lua/runtime.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lua/runtime.rs b/src/lua/runtime.rs index dfb37e6..4e8c52b 100644 --- a/src/lua/runtime.rs +++ b/src/lua/runtime.rs @@ -3,17 +3,20 @@ use std::time::{SystemTime, UNIX_EPOCH}; use crate::{ config::{self, GlobalConfig}, - sheet::register::Register, + sheet::register::Register, state::GlobalState, }; pub fn neosheet(lua: &Lua) -> Result<()> { let exports = lua.create_table()?; exports - .set("sheets", lua.create_proxy::<Register>()?) + .set("sheets", lua.create_userdata(Register)?) .unwrap(); exports - .set("config", lua.create_userdata(GlobalConfig::new())?) + .set("config", lua.create_userdata(GlobalConfig::default())?) + .unwrap(); + exports + .set("state", lua.create_userdata(GlobalState::default())?) .unwrap(); lua.globals() |