You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
localExecutor= {
extends="Node",
}
functionExecutor:execute(code)
ifcode==nilorcode=="" thenreturnfalseend-- Code to executelocaltemp_code=loadstring(code)
-- Execute the code and capture the resultslocalsuccess, result=pcall(temp_code)
-- Check if there was an error and print it if necessaryifnotsuccessthenprint("Error executing code:", result)
returnfalseend-- Print the output of the code if there is anyifresult~=nilthenprint("Output:", result)
endreturntrueendfunctionExecutor:_process()
localvalue=self:get_parent():get_parent().playifvalue==truethenlocalcode_to_run=self:get_parent():get_parent():get_node("CoreUI/ScriptEditor/TextEdit").textprint(type(code_to_run))
self:execute(code_to_run)
endendreturnExecutor```itkeepsongivingmeerrorof:
E 0:00:13.272 loadstring: bad argument #1 to 'loadstring' (function expected, got cdata)
stack traceback:
[string "res://Scripts/Core/Scripting/Executor.lua"]:10: in function 'execute'
[string "res://Scripts/Core/Scripting/Executor.lua"]:35: in function <[string "res://Scripts/Core/Scripting/Executor.lua"]:29>
in call _process @ "res://Scripts/Core/Scripting/Executor.lua"
E 0:00:13.272 loadstring: bad argument #1 to 'loadstring' (function expected, got cdata)
stack traceback:
[string "res://Scripts/Core/Scripting/Executor.lua"]:10: in function 'execute'
[string "res://Scripts/Core/Scripting/Executor.lua"]:35: in function <[string "res://Scripts/Core/Scripting/Executor.lua"]:29>
in call _process @ "res://Scripts/Core/Scripting/Executor.lua"