Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions content/en-us/reference/engine/globals/LuaGlobals.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,20 @@ functions:
errors. In such case, `pcall()` also returns all results from the call,
after this first result. In case of any error, `pcall()` returns false
plus the error message.
```lua
local function divideByFive(n: number): number
return n / 5
end
local success, errorMessage = pcall(divideByFive, "notANumber") -- Results in error...
if success then
-- Handle successful response...
else
warn("Error message:", errorMessage)
end
```
parameters:
- name: func
type: function
Expand Down