The LuaSandbox class

Introduction

The LuaSandbox class creates a Lua environment and allows for execution of Lua code.

Class synopsis

LuaSandbox
class LuaSandbox {
/* Constants */
const int LuaSandbox::SAMPLES = 0;
const int LuaSandbox::SECONDS = 1;
const int LuaSandbox::PERCENT = 2;
/* Methods */
public arraybool callFunction(string $name, mixed ...$args)
public void disableProfiler()
public bool enableProfiler(float $period = 0.02)
public float getCPUUsage()
public int getMemoryUsage()
public int getPeakMemoryUsage()
public array getProfilerFunctionReport(int $units = LuaSandbox::SECONDS)
public static array getVersionInfo()
public LuaSandboxFunction loadBinary(string $code, string $chunkName = '')
public LuaSandboxFunction loadString(string $code, string $chunkName = '')
public bool pauseUsageTimer()
public void registerLibrary(string $libname, array $functions)
public void setCPULimit(floatbool $limit)
public void setMemoryLimit(int $limit)
public void unpauseUsageTimer()
public LuaSandboxFunction wrapPhpFunction(callable $function)
}

Predefined Constants

LuaSandbox::SAMPLES

Used with LuaSandbox::getProfilerFunctionReport to return timings in samples.

LuaSandbox::SECONDS

Used with LuaSandbox::getProfilerFunctionReport to return timings in seconds.

LuaSandbox::PERCENT

Used with LuaSandbox::getProfilerFunctionReport to return timings in percentages of the total.

Table of Contents