Phasor is a server extension for Halo PC which focuses on giving the end-user the ability to deeply customize gameplay. Phasor does this via its scripting system, which uses the Lua language. Scripters are able to react to and change many different aspects of the game.
MIT License
19
stars
9
forks
source link
Special script that is called when another script crashes #54
Is it possible for there to be a script that Phasor looks for and executes when another running script crashes? For example, let's say your current script "MyScript.lua" crashes. Phasor will then execute this script that is in a specific directory (for example, the script might have to be called crash.lua and in the directory scripts/crash or something similar). The script would have one event function called OnScriptCrash, which would take in the script filename, possibly the error or the event function which caused the crash, etc. This will especially be useful when saving variables to Phasor is supported. As an example of how this would be useful, if I'm writing my own version of mapvote, I could do this:
function OnScriptCrash(name, err)
local mapvote = phasorload("mapvote") -- load the variable 'mapvote' from Phasor
for k,v in pairs(mapvote.list) do
if table.find(mapvote.list[k].scripts, name) then -- check if this mapvote option contains this script
local grave = phasorload("grave") -- load the function 'grave' from Phasor
grave(k) -- this function essentially deletes the mapvote option from the list, but saves it in a separate table so it can be added back easily
end
end
end
The above code would just make sure that the mapvote script wouldn't include mapvote options which contain scripts that are messed up.
Is it possible for there to be a script that Phasor looks for and executes when another running script crashes? For example, let's say your current script "MyScript.lua" crashes. Phasor will then execute this script that is in a specific directory (for example, the script might have to be called crash.lua and in the directory scripts/crash or something similar). The script would have one event function called OnScriptCrash, which would take in the script filename, possibly the error or the event function which caused the crash, etc. This will especially be useful when saving variables to Phasor is supported. As an example of how this would be useful, if I'm writing my own version of mapvote, I could do this:
The above code would just make sure that the mapvote script wouldn't include mapvote options which contain scripts that are messed up.