Last active
September 13, 2022 15:10
-
-
Save RealEthanPlayzDev/af4f14c56ac2548597ee6cfb2db855a9 to your computer and use it in GitHub Desktop.
fpcall - full pcall (available in lua and luau)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function fpcall(f, success, err, ...) | |
local Results = {pcall(f, ...)} | |
local Success = table.remove(Results, 1) | |
if Success then | |
success(table.unpack(Results)) | |
else | |
err(table.unpack(Results)) | |
end | |
return | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function fpcall(f: (...any) -> (...any), success: (...any) -> (), err: (errmessage: string) -> (), ... : any) | |
local Results = {pcall(f, ...)} | |
local Success = table.remove(Results, 1) | |
if Success then | |
success(table.unpack(Results)) | |
else | |
err(table.unpack(Results)) | |
end | |
return | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment