Module molly.utils
Helpers.
Functions
| setenv (key, value) | Set and unset environment variable. |
| cwd () | Get current directory. |
| chdir (dir) | Change current directory. |
| is_tarantool () | Defines whether we run under Tarantool. |
| is_numeric (x) | Check whether a value is a number or a numeric cdata value. |
| is_integer (x) | Check whether a value is an integer. |
| basename (path) | Function equivalent to basename in POSIX systems |
| pack () | Packs the given arguments into a table with an n key
denoting the number of elements. |
| copy_table (tbl) | Return a shallow copy of a table. |
Functions
- setenv (key, value)
-
Set and unset environment variable.
Parameters:
Returns:
-
true
Raises:
error - cwd ()
-
Get current directory.
Returns:
-
string, absolute path to a current directory
- chdir (dir)
-
Change current directory.
Parameters:
- dir string
Returns:
-
boolean
- is_tarantool ()
-
Defines whether we run under Tarantool.
Returns:
-
boolean
- is_numeric (x)
-
Check whether a value is a number or a numeric cdata value.
Accepts Lua numbers and numeric cdata (for example, a Tarantool
64-bit monotonic clock); rejects strings and non-numeric cdata.
Parameters:
- x Value to check.
Returns:
-
boolean
- is_integer (x)
-
Check whether a value is an integer.
Parameters:
- x Value to check.
Returns:
-
boolean
- basename (path)
-
Function equivalent to basename in POSIX systems
Parameters:
- path string
Returns:
-
string
- pack ()
-
Packs the given arguments into a table with an
nkey denoting the number of elements.Returns:
-
table
- copy_table (tbl)
-
Return a shallow copy of a table.
Nested tables are shared with the source table.
Parameters:
- tbl Table to copy.
Returns:
-
table