Verifier
Used for testing assumptions about code.
The verifier section gives users the ability to test assumptions about their code before running any of it. This helps to prevent unexpected code failures.
The verifier goes before the trigger of a function or other executable member.
1
function example_function:
2
verify:
3
assert "hello" is a string
4
trigger:
5
print "hello"
Copied!
The verifier section is run once with empty arguments for the function's parameters.
1
function example_function (a, b):
2
verify:
3
assert {a} is null
4
assert {b} is null
5
trigger: // ...
Copied!
Verifiers cannot run delays or deferred code.
The verifier is run when the script is loaded, allowing users to test for file permissions, certain libraries being available, versions or systems, etc.
This stops your script from failing at a dangerous point (e.g. when mid-way through saving important data.)
Copy link