43 std::function<void(std::string_view chunkName, std::string_view text)>
printSink;
66 using ModuleResolver = std::function<std::expected<ModuleFile, std::string>(std::string_view name)>;
84 [[nodiscard]]
static std::expected<std::unique_ptr<LuauSandbox>, std::string>
Create(
SandboxLimits limits);
93 [[nodiscard]] std::expected<void, ScriptError>
RegisterFunction(
const char* tableName,
const char* name,
102 [[nodiscard]] std::expected<RunResult, ScriptError>
Run(std::string_view chunkName, std::string_view source,
110 [[nodiscard]]
static void*
HostContext(lua_State* state);
115 [[nodiscard]] std::expected<void, std::string>
OpenLibraries();
118 static void*
Allocate(
void* userData,
void* pointer,
size_t oldSize,
size_t newSize);
119 static void Interrupt(lua_State* state,
int gc);
120 static int Print(lua_State* state);
121 static int Require(lua_State* state);
123 [[nodiscard]] std::expected<RunResult, ScriptError>
RunThread(lua_State* thread, std::string_view chunkName,
124 const char* bytecode,
size_t bytecodeSize,
126 [[nodiscard]] std::expected<RunResult, ScriptError>
CollectResults(lua_State* thread,
127 std::string_view chunkName,
132 [[nodiscard]] std::expected<void, std::string>
LoadModule(lua_State* state, std::string_view name);
133 [[nodiscard]] std::expected<void, std::string>
RunModule(lua_State* state,
const std::string& chunkName,
134 std::string_view source);
std::expected< RunResult, ScriptError > Run(std::string_view chunkName, std::string_view source, const RunOptions &options={})
void BeginModules(lua_State *thread, const ModuleResolver *modules)
std::string m_currentChunk
std::expected< void, ScriptError > RegisterFunction(const char *tableName, const char *name, HostFunction function, void *context)
std::expected< RunResult, ScriptError > CollectResults(lua_State *thread, std::string_view chunkName, const RunOptions &options)
static void Interrupt(lua_State *state, int gc)
std::expected< void, std::string > OpenLibraries()
uint64_t m_safepointCount
uint64_t MemoryBytes() const
static int Require(lua_State *state)
std::expected< void, std::string > RunModule(lua_State *state, const std::string &chunkName, std::string_view source)
LuauSandbox & operator=(const LuauSandbox &)=delete
std::expected< void, std::string > LoadModule(lua_State *state, std::string_view name)
LuauSandbox(const LuauSandbox &)=delete
static std::expected< std::unique_ptr< LuauSandbox >, std::string > Create(SandboxLimits limits)
std::expected< RunResult, ScriptError > RunThread(lua_State *thread, std::string_view chunkName, const char *bytecode, size_t bytecodeSize, const RunOptions &options)
static void * Allocate(void *userData, void *pointer, size_t oldSize, size_t newSize)
const ModuleResolver * m_modules
std::vector< std::string > m_moduleLoading
static void * HostContext(lua_State *state)
static int Print(lua_State *state)
std::function< std::expected< ModuleFile, std::string >(std::string_view name)> ModuleResolver
int(*)(lua_State *state) HostFunction
const ModuleResolver * modules
std::vector< std::string > returns
std::vector< ScriptValue > values
std::function< void(std::string_view chunkName, std::string_view text)> printSink
uint64_t memoryLimitBytes