Skip to content

Instantly share code, notes, and snippets.

@Corecii
Created May 21, 2020 22:05
Show Gist options
  • Save Corecii/91e9062fdb7ea4276f91581af79b08b1 to your computer and use it in GitHub Desktop.
Save Corecii/91e9062fdb7ea4276f91581af79b08b1 to your computer and use it in GitHub Desktop.
Roblox TS Try/Catch/Finally Example
-- Compiled with roblox-ts v0.4.0
local TS = require(game:GetService("ReplicatedStorage"):WaitForChild("rbxts_include"):WaitForChild("RuntimeLib"))
local function example()
while true do
local _0, _1 = TS.try(function()
return TS.TRY_RETURN, {}
end, function(err)
return TS.TRY_CONTINUE
end, function()
return TS.TRY_BREAK
end)
if _0 == TS.TRY_RETURN then
return unpack(_1)
elseif _0 == TS.TRY_BREAK then
break
elseif _0 then
continue
end
end
end
function example() {
while (true) {
try {
return;
} catch(err) {
continue;
} finally {
break;
}
}
}
export {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment