mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-25 14:14:41 +01:00
A mod with a reskate-plugin.json is a plugin: Luau scripts that run in their own VM, with only
the reskate API ReSkate registers for them. Luau 0.741 is vendored in External/luau (the VM and
compiler only: no native code generation, no loadstring, io or C modules).
- Limits: 64 MB of memory, 50 ms a call, 2 ms a tick on average (over it for 3 s stops it),
more than 5 errors in 10 s stops it, 50 log lines a second. A plugin over a limit cannot catch
it in a pcall and carry on.
- API: reskate.log, on (load, unload, tick, level_loaded, level_unloading), timers, the level,
its own package's files and JSON, require inside the package; console.command and print
("console"); storage get, set, add and keys ("storage"), 1 MB in
%LOCALAPPDATA%\ReSkate\Plugins\<mod>\storage.json.
- Found every 2 s among the mods mods.json leaves on: switching a mod, or changing a plugin's
files, loads, unloads or reloads it without a restart. A package holding a program is refused.
- plugin list, commands, reload, off and on in the console. A plugin cannot take a name of
ReSkate's own commands.
- Tests: DINGOSDK_BUILD_PLUGIN_TESTS, including plugins written to break the sandbox.
67 lines
1.6 KiB
C++
67 lines
1.6 KiB
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
#pragma once
|
|
|
|
#include "ValueTracking.h"
|
|
|
|
namespace Luau
|
|
{
|
|
struct CompileOptions;
|
|
}
|
|
|
|
namespace Luau
|
|
{
|
|
namespace Compile
|
|
{
|
|
|
|
struct Builtin
|
|
{
|
|
AstName object;
|
|
AstName method;
|
|
|
|
bool empty() const
|
|
{
|
|
return object == AstName() && method == AstName();
|
|
}
|
|
|
|
bool isGlobal(const char* name) const
|
|
{
|
|
return object == AstName() && method == name;
|
|
}
|
|
|
|
bool isMethod(const char* table, const char* name) const
|
|
{
|
|
return object == table && method == name;
|
|
}
|
|
};
|
|
|
|
Builtin getBuiltin(AstExpr* node, const DenseHashMap<AstName, Global>& globals, const DenseHashMap<AstLocal*, Variable>& variables);
|
|
|
|
void analyzeBuiltins(
|
|
DenseHashMap<AstExprCall*, int>& result,
|
|
const DenseHashMap<AstName, Global>& globals,
|
|
const DenseHashMap<AstLocal*, Variable>& variables,
|
|
const CompileOptions& options,
|
|
AstNode* root,
|
|
const AstNameTable& names
|
|
);
|
|
|
|
struct BuiltinInfo
|
|
{
|
|
enum Flags
|
|
{
|
|
// none-safe builtins are builtins that have the same behavior for arguments that are nil or none
|
|
// this allows the compiler to compile calls to builtins more efficiently in certain cases
|
|
// for example, math.abs(x()) may compile x() as if it returns one value; if it returns no values, abs() will get nil instead of none
|
|
Flag_NoneSafe = 1 << 0,
|
|
};
|
|
|
|
int params;
|
|
int results;
|
|
unsigned int flags;
|
|
};
|
|
|
|
BuiltinInfo getBuiltinInfo(int bfid);
|
|
|
|
} // namespace Compile
|
|
} // namespace Luau
|