1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-14 17:15:21 +02:00

Refactor loading of Lua code with mod security

This commit is contained in:
sfan5
2019-11-08 18:35:32 +01:00
parent 17191a60fb
commit 5ab546f99b
2 changed files with 28 additions and 52 deletions

View File

@@ -50,6 +50,8 @@ public:
void initializeSecurityClient();
// Checks if the Lua state has been secured
static bool isSecure(lua_State *L);
// Loads a string as Lua code safely (doesn't allow bytecode).
static bool safeLoadString(lua_State *L, const std::string &code, const char *chunk_name);
// Loads a file as Lua code safely (doesn't allow bytecode).
static bool safeLoadFile(lua_State *L, const char *path, const char *display_name = NULL);
// Checks if mods are allowed to read (and optionally write) to the path