Skip to main content

TerminateCurrentScript

This function was added in DSL 1

Description

This function replaces the existing TerminateCurrentScript.

If DSL is not running or UseBaseGameScriptFunctions was called with true, the original function is used. Otherwise the current DSL script is shutdown.

This does not instantly take control away from your script, meaning your code will continue execution until the current thread yields or control is otherwise returned to DSL.

function TerminateCurrentScript() --[[ ... ]] end

Parameters

None.

Return Values

None.

Example

Stop the script when a button is pressed.

function main()
while not SystemIsReady() do
Wait(0)
end
while true do
TextPrintString('running', 0, 2)
Wait(0)
if IsButtonBeingPressed(3,0) then
TerminateCurrentScript()
print('this will be printed because control is not instantly taken away')
Wait(0)
print('this will not be printed because waiting gave control back to DSL')
end
end
end

See Also