mirror of
https://github.com/lunarmodules/luasocket.git
synced 2025-07-04 01:54:29 +02:00
Update comment in except.lua
This commit is contained in:
parent
da6ddad532
commit
0cf7161886
@ -14,14 +14,19 @@
|
|||||||
-- the other values don't matter.
|
-- the other values don't matter.
|
||||||
|
|
||||||
-- The idea is to nest function calls with the "try" function. This function
|
-- The idea is to nest function calls with the "try" function. This function
|
||||||
-- checks the first value, and calls "error" on the second if the first is
|
-- checks the first value, and, if it's falsy, wraps the second value
|
||||||
-- nil. Otherwise, it returns all values it received.
|
-- in a table with metatable and calls "error" on it. Otherwise,
|
||||||
|
-- it returns all values it received.
|
||||||
|
|
||||||
-- The protect function returns a new function that behaves exactly like the
|
-- The "newtry" function is a factory for "try" functions that call a finalizer
|
||||||
-- function it receives, but the new function doesn't throw exceptions: it
|
-- in protected mode before calling "error".
|
||||||
-- returns nil followed by the error message instead.
|
|
||||||
|
|
||||||
-- With these two function, it's easy to write functions that throw
|
-- The "protect" function returns a new function that behaves exactly like the
|
||||||
|
-- function it receives, but the new function catches exceptions
|
||||||
|
-- thrown by "try" functions and returns nil followed by the error message
|
||||||
|
-- instead.
|
||||||
|
|
||||||
|
-- With these three function, it's easy to write functions that throw
|
||||||
-- exceptions on error, but that don't interrupt the user script.
|
-- exceptions on error, but that don't interrupt the user script.
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user