mirror of
https://github.com/lune-org/lune.git
synced 2024-12-13 21:40:40 +00:00
27 lines
598 B
Rust
27 lines
598 B
Rust
use mlua::prelude::*;
|
|
|
|
pub mod datatypes;
|
|
pub mod document;
|
|
pub mod instance;
|
|
|
|
use datatypes::types::*;
|
|
use datatypes::DatatypeTable;
|
|
|
|
fn make_dt<F>(lua: &Lua, f: F) -> LuaResult<LuaTable>
|
|
where
|
|
F: Fn(&Lua, &LuaTable) -> LuaResult<()>,
|
|
{
|
|
let tab = lua.create_table()?;
|
|
f(lua, &tab)?;
|
|
tab.set_readonly(true);
|
|
Ok(tab)
|
|
}
|
|
|
|
pub fn module(lua: &Lua) -> LuaResult<LuaTable> {
|
|
let datatypes = vec![("Vector3", make_dt(lua, Vector3::make_dt_table)?)];
|
|
let exports = lua.create_table()?;
|
|
for (name, tab) in datatypes {
|
|
exports.set(name, tab)?;
|
|
}
|
|
Ok(exports)
|
|
}
|