From 42ec7286b2d36a9ba22925f816a17cb1cc2aa5ce Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 30 Oct 2021 11:32:16 +0800 Subject: + Penlight --- .../Penlight/docs/libraries/pl.compat.html | 580 +++++++++++++++++++++ 1 file changed, 580 insertions(+) create mode 100644 Data/Libraries/Penlight/docs/libraries/pl.compat.html (limited to 'Data/Libraries/Penlight/docs/libraries/pl.compat.html') diff --git a/Data/Libraries/Penlight/docs/libraries/pl.compat.html b/Data/Libraries/Penlight/docs/libraries/pl.compat.html new file mode 100644 index 0000000..6680030 --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.compat.html @@ -0,0 +1,580 @@ + + + + + Penlight Documentation + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module pl.compat

+

Lua 5.1/5.2/5.3 compatibility.

+

Injects table.pack, table.unpack, and package.searchpath in the global + environment, to make sure they are available for Lua 5.1 and LuaJIT.

+ +

All other functions are exported as usual in the returned module table.

+ +

NOTE: everything in this module is also available in pl.utils.

+ + +

Functions

+ + + + + + + + + + + + + + + + + +
execute (cmd)execute a shell command, in a compatible and platform independent way.
load (ld[, source[, mode[, env]]])Load Lua code as a text or binary chunk (in a Lua 5.2 compatible way).
getfenv (f)Get environment of a function (in a Lua 5.1 compatible way).
setfenv (f, env)Set environment of a function (in a Lua 5.1 compatible way).
+

Fields

+ + + + + + + + + + + + + + + + + + + + + +
lua51boolean flag this is Lua 5.1 (or LuaJIT).
jitboolean flag this is LuaJIT.
jit52boolean flag this is LuaJIT with 5.2 compatibility compiled in.
dir_separatorthe directory separator character for the current platform.
is_windowsboolean flag this is a Windows platform.
+

Global exported functions (for Lua 5.1 & LuaJIT)

+ + + + + + + + + + + + + +
table.pack (...)pack an argument list into a table.
table.unpack (t[, i[, t]])unpack a table and return the elements.
package.searchpath (name, path[, sep[, rep]])return the full path where a file name would be matched.
+

Global exported functions (for Lua < 5.4)

+ + + + + +
warn (...)raise a warning message.
+ +
+
+ + +

Functions

+ +
+
+ + execute (cmd) +
+
+ execute a shell command, in a compatible and platform independent way. + This is a compatibility function that returns the same for Lua 5.1 and + Lua 5.2+.

+ +

NOTE: Windows systems can use signed 32bit integer exitcodes. Posix systems + only use exitcodes 0-255, anything else is undefined.

+ +

NOTE2: In Lua 5.2 and 5.3 a Windows exitcode of -1 would not properly be + returned, this function will return it properly for all versions. + + +

Parameters:

+
    +
  • cmd + a shell command +
  • +
+ +

Returns:

+
    +
  1. + true if successful
  2. +
  3. + actual return code
  4. +
+ + + + +
+
+ + load (ld[, source[, mode[, env]]]) +
+
+ Load Lua code as a text or binary chunk (in a Lua 5.2 compatible way). + + +

Parameters:

+
    +
  • ld + code string or loader +
  • +
  • source + name of chunk for errors + (optional) +
  • +
  • mode + 'b', 't' or 'bt' + (optional) +
  • +
  • env + environment to load the chunk in + (optional) +
  • +
+ + + + + +
+
+ + getfenv (f) +
+
+ Get environment of a function (in a Lua 5.1 compatible way). + Not 100% compatible, so with Lua 5.2 it may return nil for a function with no + global references! + Based on code by Sergey Rozhenko + + +

Parameters:

+
    +
  • f + a function or a call stack reference +
  • +
+ + + + + +
+
+ + setfenv (f, env) +
+
+ Set environment of a function (in a Lua 5.1 compatible way). + + +

Parameters:

+
    +
  • f + a function or a call stack reference +
  • +
  • env + a table that becomes the new environment of f +
  • +
+ + + + + +
+
+

Fields

+ +
+
+ + lua51 +
+
+ boolean flag this is Lua 5.1 (or LuaJIT). + + +
    +
  • lua51 + + + +
  • +
+ + + + + +
+
+ + jit +
+
+ boolean flag this is LuaJIT. + + +
    +
  • jit + + + +
  • +
+ + + + + +
+
+ + jit52 +
+
+ boolean flag this is LuaJIT with 5.2 compatibility compiled in. + + +
    +
  • jit52 + + + +
  • +
+ + + + + +
+
+ + dir_separator +
+
+ the directory separator character for the current platform. + + +
    +
  • dir_separator + + + +
  • +
+ + + + + +
+
+ + is_windows +
+
+ boolean flag this is a Windows platform. + + +
    +
  • is_windows + + + +
  • +
+ + + + + +
+
+

Global exported functions (for Lua 5.1 & LuaJIT)

+ +
+
+ + table.pack (...) +
+
+ pack an argument list into a table. + + +

Parameters:

+
    +
  • ... + any arguments +
  • +
+ +

Returns:

+
    + + a table with field n set to the length +
+ + + + +
+
+ + table.unpack (t[, i[, t]]) +
+
+ unpack a table and return the elements.

+ +

NOTE: this version does NOT honor the n field, and hence it is not nil-safe. + See utils.unpack for a version that is nil-safe. + + +

Parameters:

+
    +
  • t + index of the last element to unpack, defaults to #t + (optional) +
  • +
  • i + index from which to start unpacking, defaults to 1 + (optional) +
  • +
  • t + index of the last element to unpack, defaults to #t + (optional) +
  • +
+ +

Returns:

+
    + + multiple return values from the table +
+ + +

See also:

+ + + +
+
+ + package.searchpath (name, path[, sep[, rep]]) +
+
+ return the full path where a file name would be matched. + This function was introduced in Lua 5.2, so this compatibility version + will be injected in Lua 5.1 engines. + + +

Parameters:

+
    +
  • name + string + file name, possibly dotted +
  • +
  • path + string + a path-template in the same form as package.path or package.cpath +
  • +
  • sep + string + template separate character to be replaced by path separator. Default: "." + (optional) +
  • +
  • rep + string + the path separator to use, defaults to system separator. Default; "/" on Unixes, "\" on Windows. + (optional) +
  • +
+ +

Returns:

+
    +
  1. + on success: path of the file
  2. +
  3. + on failure: nil, error string listing paths tried
  4. +
+ + +

See also:

+ + + +
+
+

Global exported functions (for Lua < 5.4)

+ +
+
+ + warn (...) +
+
+ raise a warning message. + This functions mimics the warn function added in Lua 5.4. + + +

Parameters:

+
    +
  • ... + any arguments +
  • +
+ + + + + +
+
+ + +
+
+
+generated by LDoc 1.4.6 +
+
+ + -- cgit v1.1-26-g67d0