Remove extra indentation level

This commit is contained in:
Arseny Kapoulkine 2021-11-21 20:11:28 -08:00
parent 609f68492a
commit 1c3095f6dd

View file

@ -79,31 +79,28 @@ static std::string runCode(lua_State* L, const std::string& source)
return std::string(); return std::string();
} }
extern "C" extern "C" const char* executeScript(const char* source)
{ {
const char* executeScript(const char* source) // setup flags
{ for (Luau::FValue<bool>* flag = Luau::FValue<bool>::list; flag; flag = flag->next)
// setup flags if (strncmp(flag->name, "Luau", 4) == 0)
for (Luau::FValue<bool>* flag = Luau::FValue<bool>::list; flag; flag = flag->next) flag->value = true;
if (strncmp(flag->name, "Luau", 4) == 0)
flag->value = true;
// create new state // create new state
std::unique_ptr<lua_State, void (*)(lua_State*)> globalState(luaL_newstate(), lua_close); std::unique_ptr<lua_State, void (*)(lua_State*)> globalState(luaL_newstate(), lua_close);
lua_State* L = globalState.get(); lua_State* L = globalState.get();
// setup state // setup state
setupState(L); setupState(L);
// sandbox thread // sandbox thread
luaL_sandboxthread(L); luaL_sandboxthread(L);
// static string for caching result (prevents dangling ptr on function exit) // static string for caching result (prevents dangling ptr on function exit)
static std::string result; static std::string result;
// run code + collect error // run code + collect error
result = runCode(L, source); result = runCode(L, source);
return result.empty() ? NULL : result.c_str(); return result.empty() ? NULL : result.c_str();
}
} }