-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sorted init and added handle_fn_result
- Loading branch information
1 parent
0ffdb47
commit ae5d182
Showing
2 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
-- @module worldeditadditions_core | ||
local wea_c = worldeditadditions_core | ||
|
||
--- Handles the result of a function call. | ||
--- @param ... any The full output of the function call. | ||
local function handle_fn_result(...) | ||
local result = { ... } | ||
local ret = "" | ||
local success = table.remove(result, 1) | ||
if #result > 1 then | ||
ret = wea_c.table.tostring(result) | ||
elseif #result == 1 then | ||
ret = tostring(result[1]) | ||
else | ||
ret = table.concat({ | ||
"Function returned \"", | ||
tostring(success), | ||
"\" with no other output." | ||
}, " ") | ||
end | ||
return success, ret | ||
end | ||
|
||
return handle_fn_result |
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