Last active
November 10, 2024 18:10
-
-
Save XDuskAshes/d6ebfe628562089b66e5588cb940fb0e to your computer and use it in GitHub Desktop.
Dusk's ComputerCraft Snippets
This file contains hidden or 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
| -- Call a function in an xpcall() wrapper. | |
| local function safeCall(f,args) | |
| if not type(f) == "function" then | |
| return false, "[libcommon]: cannot safeCall "..f..": not a function" | |
| end | |
| local function errorHandle(errormsg) | |
| return false, "[libcommon]: exec error: "..errormsg | |
| end | |
| local status, result = xpcall(function() return f(table.unpack(args or {})) end, errorHandle) | |
| return status, result | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment