so you're telling me that compiles

This commit is contained in:
Quaternions 2024-10-05 14:28:17 -07:00
parent 56f6738028
commit ae0b46e217
3 changed files with 61 additions and 1 deletions

49
Cargo.lock generated
View File

@ -183,6 +183,48 @@ version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]]
name = "phf"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
dependencies = [
"phf_macros",
"phf_shared",
]
[[package]]
name = "phf_generator"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0"
dependencies = [
"phf_shared",
"rand",
]
[[package]]
name = "phf_macros"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b"
dependencies = [
"phf_generator",
"phf_shared",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "phf_shared"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b"
dependencies = [
"siphasher",
]
[[package]]
name = "pkg-config"
version = "0.3.30"
@ -322,6 +364,7 @@ version = "0.4.1"
dependencies = [
"glam",
"mlua",
"phf",
"rbx_dom_weak",
"rbx_reflection",
"rbx_reflection_database",
@ -360,6 +403,12 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "siphasher"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]]
name = "syn"
version = "2.0.77"

View File

@ -10,6 +10,7 @@ authors = ["Rhys Lloyd <krakow20@gmail.com>"]
[dependencies]
glam = "0.29.0"
mlua = { version = "0.9.9", features = ["luau"] }
phf = { version = "0.11.2", features = ["macros"] }
rbx_dom_weak = { version = "2.7.0", registry = "strafesnet" }
rbx_reflection = { version = "4.7.0", registry = "strafesnet" }
rbx_reflection_database = { version = "0.2.10", registry = "strafesnet" }

View File

@ -1,6 +1,6 @@
use std::collections::HashMap;
use mlua::IntoLua;
use mlua::{IntoLua,IntoLuaMulti};
use rbx_types::Ref;
use rbx_dom_weak::{InstanceBuilder,WeakDom};
@ -17,6 +17,16 @@ struct ClassFunctions<'a>{
>
}
fn place_id<'lua>(lua:&'lua mlua::Lua,tuple:mlua::MultiValue<'lua>)->mlua::Result<mlua::MultiValue<'lua>>{
0.into_lua_multi(lua)
}
type FPointer=for<'lua> fn(&'lua mlua::Lua,mlua::MultiValue<'lua>)->mlua::Result<mlua::MultiValue<'lua>>;
static CLASS_FUNCTION_DATABASE:phf::Map<&str,phf::Map<&str,FPointer>>=phf::phf_map!{
"DataModel"=>phf::phf_map!{
"GetService"=>|a,b|place_id(a,b),
}
};
pub fn set_globals(lua:&mlua::Lua,globals:&mlua::Table<'_>)->Result<(),mlua::Error>{
//class functions store
lua.set_app_data::<ClassFunctions<'static>>(ClassFunctions::default());