readme.md
https://discord.com/channels/415878436104437770/547090551539761153/1115160764546809856
try.src
//try
try = get_custom_object
try.success = false
try.store = {}
try.fn =""
try.this = function( input_function, function_name="anon" )
try.store[function_name] = @input_function
try.fn = function_name
print "trying: " + try.fn
try.write( function_name )
get_shell.build( current_path+"/"+function_name+".src", current_path, 0 )
print "<b>evaluating...</b>"
try.success = false
wait(1)
print get_shell.launch( current_path+"/"+function_name )
if try.success == false then print "function crashed!" else print "<b>function didn't crash!</b>"
return try.success
end function
try.write = function( fname )
print "<b><u>writing source...</b></u>"
fname = fname+".src"
comp = get_shell.host_computer
comp.touch( current_path, fname )
outfile = comp.File( fname )
output = []
output.push( "try=get_custom_object" )
output.push( "f = @try.store[try.fn]" )
output.push( "print ""function returns: ""+f" )
output.push( "try.success = true" )
output.push( "exit ""success"" " )
outfile.set_content( output.join(char(10)) )
end function
test = function()
print
return "Worky worky" // should work..
end function
test2 = function()
print
mobile // this will fail
return mob
end function
if try.this(@test,"test") == true then print "Yusss!"+char(10) else print "awwwww :["+char(10)
if try.this(@test2,"test2") == true then print "Yusss!"+char(10) else print "awwwww :["+char(10)