Bicameral Engine
GPU-resident engine for a magic-research open-world game
Loading...
Searching...
No Matches
bicameral::script::anonymous_namespace{luau_sandbox.cpp} Namespace Reference

Classes

struct  LibraryEntry

Typedefs

using Bytecode = std::unique_ptr<char, decltype(&std::free)>

Functions

int OpenOneLibrary (lua_State *state)
std::string ValueToText (lua_State *state, int index)
std::expected< ScriptValue, std::string > ReadValue (lua_State *state, int index, std::vector< const void * > &path)
std::expected< ScriptValue, std::string > ReadKey (lua_State *state, int index)
std::expected< ScriptValue, std::string > ReadTable (lua_State *state, int index, std::vector< const void * > &path)
Bytecode Compile (std::string_view source, size_t &bytecodeSize)
ScriptErrorKind ClassifyError (int status, bool safepointExceeded, bool memoryExceeded)

Variables

constexpr LibraryEntry ALLOWED_LIBRARIES []
constexpr const char * HIDDEN_GLOBALS [] = {"gcinfo", "getfenv", "setfenv", "newproxy"}
constexpr size_t MAX_VALUE_DEPTH = 64

Typedef Documentation

◆ Bytecode

using bicameral::script::anonymous_namespace{luau_sandbox.cpp}::Bytecode = std::unique_ptr<char, decltype(&std::free)>

Definition at line 150 of file luau_sandbox.cpp.

Function Documentation

◆ ClassifyError()

ScriptErrorKind bicameral::script::anonymous_namespace{luau_sandbox.cpp}::ClassifyError ( int status,
bool safepointExceeded,
bool memoryExceeded )

Definition at line 160 of file luau_sandbox.cpp.

References ClassifyError(), bicameral::script::Memory, bicameral::script::Runtime, and bicameral::script::SafepointLimit.

Referenced by ClassifyError().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Compile()

Bytecode bicameral::script::anonymous_namespace{luau_sandbox.cpp}::Compile ( std::string_view source,
size_t & bytecodeSize )

Definition at line 152 of file luau_sandbox.cpp.

◆ OpenOneLibrary()

int bicameral::script::anonymous_namespace{luau_sandbox.cpp}::OpenOneLibrary ( lua_State * state)

Definition at line 48 of file luau_sandbox.cpp.

References OpenOneLibrary().

Referenced by OpenOneLibrary().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadKey()

std::expected< ScriptValue, std::string > bicameral::script::anonymous_namespace{luau_sandbox.cpp}::ReadKey ( lua_State * state,
int index )

Definition at line 81 of file luau_sandbox.cpp.

References bicameral::script::ScriptValue::MakeNumber(), bicameral::script::ScriptValue::MakeString(), and ReadKey().

Referenced by ReadKey(), ReadTable(), and ReadValue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadTable()

std::expected< ScriptValue, std::string > bicameral::script::anonymous_namespace{luau_sandbox.cpp}::ReadTable ( lua_State * state,
int index,
std::vector< const void * > & path )

Definition at line 96 of file luau_sandbox.cpp.

References bicameral::script::ScriptValue::MakeTable(), MAX_VALUE_DEPTH, ReadKey(), ReadTable(), and ReadValue().

Referenced by ReadTable(), and ReadValue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadValue()

std::expected< ScriptValue, std::string > bicameral::script::anonymous_namespace{luau_sandbox.cpp}::ReadValue ( lua_State * state,
int index,
std::vector< const void * > & path )

Definition at line 130 of file luau_sandbox.cpp.

References bicameral::script::ScriptValue::MakeBoolean(), bicameral::script::ScriptValue::MakeNumber(), ReadKey(), ReadTable(), and ReadValue().

Referenced by ReadTable(), and ReadValue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ValueToText()

std::string bicameral::script::anonymous_namespace{luau_sandbox.cpp}::ValueToText ( lua_State * state,
int index )

Definition at line 58 of file luau_sandbox.cpp.

References ValueToText().

Referenced by ValueToText().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ ALLOWED_LIBRARIES

LibraryEntry bicameral::script::anonymous_namespace{luau_sandbox.cpp}::ALLOWED_LIBRARIES[]
constexpr
Initial value:
= {
{.name = "", .open = luaopen_base},
{.name = LUA_COLIBNAME, .open = luaopen_coroutine},
{.name = LUA_TABLIBNAME, .open = luaopen_table},
{.name = LUA_STRLIBNAME, .open = luaopen_string},
{.name = LUA_MATHLIBNAME, .open = luaopen_math},
{.name = LUA_UTF8LIBNAME, .open = luaopen_utf8},
{.name = LUA_BITLIBNAME, .open = luaopen_bit32},
{.name = LUA_BUFFERLIBNAME, .open = luaopen_buffer},
{.name = LUA_VECLIBNAME, .open = luaopen_vector},
}

Definition at line 33 of file luau_sandbox.cpp.

◆ HIDDEN_GLOBALS

const char* bicameral::script::anonymous_namespace{luau_sandbox.cpp}::HIDDEN_GLOBALS[] = {"gcinfo", "getfenv", "setfenv", "newproxy"}
constexpr

Definition at line 46 of file luau_sandbox.cpp.

◆ MAX_VALUE_DEPTH

size_t bicameral::script::anonymous_namespace{luau_sandbox.cpp}::MAX_VALUE_DEPTH = 64
constexpr

Definition at line 77 of file luau_sandbox.cpp.

Referenced by ReadTable().