wrong function bruh
This commit is contained in:
parent
c47f30054f
commit
0eff07d22d
@ -1,6 +1,6 @@
|
||||
use std::collections::{hash_map::Entry,HashMap};
|
||||
|
||||
use mlua::{IntoLua,IntoLuaMulti};
|
||||
use mlua::{FromLuaMulti,IntoLua,IntoLuaMulti};
|
||||
use rbx_types::Ref;
|
||||
use rbx_dom_weak::{InstanceBuilder,WeakDom};
|
||||
|
||||
@ -320,15 +320,28 @@ impl mlua::UserData for Instance{
|
||||
}
|
||||
}
|
||||
|
||||
fn place_id(lua:&mlua::Lua,tuple:mlua::MultiValue)->mlua::Result<mlua::MultiValue>{
|
||||
0.into_lua_multi(lua)
|
||||
fn get_service(lua:&mlua::Lua,tuple:mlua::MultiValue)->mlua::Result<mlua::MultiValue>{
|
||||
let (_game,service):(Instance,mlua::String)=FromLuaMulti::from_lua_multi(tuple,lua)?;
|
||||
dom_mut(lua,|dom|{
|
||||
match &*service.to_str()?{
|
||||
"Lighting"=>{
|
||||
let referent=find_first_child_of_class(dom,dom.root(),"Lighting")
|
||||
.map(|instance|instance.referent())
|
||||
.unwrap_or_else(||
|
||||
dom.insert(dom.root_ref(),InstanceBuilder::new("Lighting"))
|
||||
);
|
||||
Instance::new(referent).into_lua_multi(lua)
|
||||
},
|
||||
other=>Err::<mlua::MultiValue,_>(mlua::Error::runtime(format!("Service '{other}' not supported"))),
|
||||
}
|
||||
})
|
||||
}
|
||||
type FPointer=fn(&mlua::Lua,mlua::MultiValue)->mlua::Result<mlua::MultiValue>;
|
||||
/// A double hash map of function pointers.
|
||||
/// The class tree is walked by the Instance.__index metamethod to find available class methods.
|
||||
static CLASS_FUNCTION_DATABASE:phf::Map<&str,phf::Map<&str,FPointer>>=phf::phf_map!{
|
||||
"DataModel"=>phf::phf_map!{
|
||||
"GetService"=>place_id as FPointer,
|
||||
"GetService"=>get_service as FPointer,
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user