From 082de122b11b3b17c3a80e48e49239aced428dfd Mon Sep 17 00:00:00 2001
From: Quaternions <krakow20@gmail.com>
Date: Sun, 6 Oct 2024 10:26:58 -0700
Subject: [PATCH] fix double convert

---
 src/runner/instance.rs | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

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)
 		}
 	};