Module pico8lib.functions
Function manipulation, creation, and helpers
Local Functions
noop () | Empty function, useful for callbacks and placeholders |
error ([m]) | Raise an error with the given message |
memoize (f) | Create a memoized version of a single parameter function |
try (t[, c][, f], ...) | try/catch/finally implemented using coroutine return codes |
Local Functions
- noop ()
- Empty function, useful for callbacks and placeholders
- error ([m])
-
Raise an error with the given message
Parameters:
- m string The error message (string) to output (optional)
- memoize (f)
-
Create a memoized version of a single parameter function
Parameters:
- f function the function to memoize
Returns:
-
function
the memoized function
- try (t[, c][, f], ...)
-
try/catch/finally implemented using coroutine return codes
Parameters:
- t function function to always call first
- c function function to call if t raises an error (optional)
- f function function to call if t or c succeeds without error (optional)
- ...
Additional parameters that will be passed to
t
,c
, andf
Returns:
-
bool
Did
t
exit without error? -
Error message or successful return value from
t