Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
David Lowndes authored and David Lowndes committed Nov 21, 2024
1 parent 3527a3f commit 1e9f30b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/common/LuaSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,13 @@ bool Surge::LuaSupport::setSurgeFunctionEnvironment(lua_State *L)
lua_setfield(L, eidx, sharedTableName);

// add whitelisted functions and modules
static constexpr std::initializer_list<const char *> sandboxWhitelist{
"pairs", "ipairs", "unpack", "next", "type",
"tostring", "tonumber", "setmetatable", "error"};

// clang-format off
static constexpr std::initializer_list<const char *> sandboxWhitelist
{"pairs", "ipairs", "unpack",
"next", "type", "tostring",
"tonumber", "setmetatable", "error"};
// clang-format on

for (const auto &f : sandboxWhitelist)
{
Expand All @@ -198,8 +202,9 @@ bool Surge::LuaSupport::setSurgeFunctionEnvironment(lua_State *L)
}

// add library tables
static constexpr std::initializer_list<const char *> sandboxLibraryTables = {"math", "string",
"table", "bit"};
// clang-format off
static constexpr std::initializer_list<const char *> sandboxLibraryTables = {"math", "string", "table", "bit"};
// clang-format on
for (const auto &t : sandboxLibraryTables)
{
lua_getglobal(L, t); // stack: f>t>(t)
Expand Down

0 comments on commit 1e9f30b

Please sign in to comment.