mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
fix logic issue
This commit is contained in:
parent
a81fecb564
commit
80ff5e3e63
2 changed files with 6 additions and 4 deletions
|
@ -204,6 +204,9 @@ extern "C"
|
|||
{
|
||||
const char* executeScript(const char* source)
|
||||
{
|
||||
// static string for caching result (prevents dangling ptr on function exit)
|
||||
static std::string result;
|
||||
|
||||
// setup flags
|
||||
for (Luau::FValue<bool>* flag = Luau::FValue<bool>::list; flag; flag = flag->next)
|
||||
if (strncmp(flag->name, "Luau", 4) == 0)
|
||||
|
@ -221,9 +224,8 @@ extern "C"
|
|||
|
||||
// run code + collect error
|
||||
std::string error = runCode(L, source);
|
||||
result = error;
|
||||
|
||||
// output error(s)
|
||||
static std::string result = error;
|
||||
if (error.length())
|
||||
{
|
||||
return result.c_str();
|
||||
|
|
Loading…
Add table
Reference in a new issue