-- Basic syntax:
status, value = pcall(function, arg1, arg2, ...)
--[[ Where:
- pcall is used to add error handling to functions and works similarly to
try-catch (try-except) in other languages
- function is the function you want to run in protected mode
- arg1, arg2, ... are the arguments passed to function and should be strings
- pcall returns two values:
1. a boolean which indicates whether function was executed without errors
2. the return value of the function (or error message if an error
occurred inside the function block
]]--
if pcall(foo) then
-- no errors while running `foo'
...
else
-- `foo' raised an error: take appropriate actions
...
end
Code Example |
---|
Lua :: roblox kill brick script |
Lua :: Lua array add item |
Lua :: roblox what is the difference between index and newindex |
Lua :: luau make debounce |
Lua :: roblox loop players |
Lua :: lua wrap number |
Lua :: lua array is empty |
Lua :: luau table.find() |
Lua :: roblox go thru all players |
Lua :: continue in lua |
Lua :: lua sort |
Lua :: json resume shema |
Lua :: lua game code |
Lua :: print a table in lua |
Lua :: lua counting |
Lua :: free roblux |
Lua :: roblox format string |
Lua :: lua pairs |
Lua :: C++ 914 card |
Lua :: lua roblox |
Matlab :: matlab plot vertical line |
Matlab :: tan in scilab |
Matlab :: matlab switch figure |
Basic :: dos/cmd equivalent to "head" |
Elixir :: elixir string concatination |
Elixir :: elixir sleep |
Scala :: scala function |
Scala :: scala get set of chars from string |
Excel :: excel formula not updating after inserting rows |
Perl :: perl read file |