fix double convert

This commit is contained in:
Quaternions 2024-10-06 10:26:58 -07:00
parent bf0c4f74c3
commit 082de122b1

View File

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