diff --git a/src/runner/instance.rs b/src/runner/instance.rs index 3059157..2286f4c 100644 --- a/src/runner/instance.rs +++ b/src/runner/instance.rs @@ -1,6 +1,6 @@ use std::collections::{hash_map::Entry,HashMap}; -use mlua::{FromLuaMulti,IntoLua,IntoLuaMulti}; +use mlua::{FromLua,FromLuaMulti,IntoLua,IntoLuaMulti}; use rbx_types::Ref; use rbx_dom_weak::{InstanceBuilder,WeakDom}; @@ -334,9 +334,8 @@ impl mlua::UserData for Instance{ /// A class function definition shorthand. macro_rules! cf{ ($f:expr)=>{ - |lua,args|{ - //TODO: make this not suck. two fully general conversions? really? - let (this,args):(Instance,mlua::MultiValue)=FromLuaMulti::from_lua_multi(args,lua)?; + |lua,mut args|{ + let this=Instance::from_lua(args.pop_front().unwrap_or(mlua::Value::Nil),lua)?; $f(lua,this,FromLuaMulti::from_lua_multi(args,lua)?)?.into_lua_multi(lua) } };