Missed my point or am I missing something?
I did indeed miss your point
Restore() only executed the first line of code and not the rest of the test script.
I don't see how that's possible, since lua doesn't know anything about lines by that point. The code you pasted isn't valid.
function restore()
print("Restore activated")
for i =1,5 do
print("fun")
end
n=0
end
n=1
while n==1 do
sleep(1000)
print("Sleeping!")
end
print("Script successfully terminated")
works as expected for me, spamming 5 "funs" before quitting.