Runik Library
Selenite Runik is a Lua extension library that allows you to run a variety of scripting languages from within Lua scripts. Runik's scripted operations can be isolated or "connected" with the variables from the Lua state of the host.
require "Runik"
function echo(s) _script.php
[[
echo($s);
]]
end
echo("Hello World!")
require "Runik"
function crc16(s) _script.php
[[
$crc = 0xFFFF;
for ($x = 0; $x < strlen ($s); $x++) {
$crc = $crc ^ ord($s[$x]);
for ($y = 0; $y < 8; $y++) {
if (($crc & 0x0001) == 0x0001) {
$crc = (($crc >> 1) ^ 0xA001);
} else { $crc = $crc >> 1; }
}
}
$s = $crc;
]]
return s
end
Options
The Runik.Options table can be used to enable or disable library features. The following options are available:
ModuleName | string | Gets or sets the module name. Default: Runik |
RedirectIO | boolean | Enables or disables the IO redirection. Disabled by default. When enabled, runik_write(v), runik_writeln(v) and runik_logerror(line,msg) may be called during a script execution. |
UseVars | boolean | Enables or disables the use of Lua variables (both local and global). Enabled by default. |
UseGlobals | boolean | Enables or disables the use of global Lua variables. Enabled by default. Requires UseVars enabled. |
UseLocals | boolean | Enables or disables the use of local Lua variables. Enabled by default. Requires UseVars enabled. |