Start getting useful error messages for Lua

pull/170/head
James Ball 2023-12-20 13:27:22 +00:00
rodzic 90fcd085be
commit e3ecb794b0
2 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -29,7 +29,10 @@ void LuaParser::parse() {
const int ret = luaL_loadstring(L, script.toUTF8());
if (ret != 0) {
const char* error = lua_tostring(L, -1);
DBG(error);
std::string newError = std::regex_replace(error, std::regex(R"(^\[string ".*"\]:)"), "");
DBG(newError);
lua_pop(L, 1);
functionRef = -1;
if (script != fallbackScript) {

Wyświetl plik

@ -1,5 +1,6 @@
#pragma once
#include <JuceHeader.h>
#include <regex>
#include "../shape/Shape.h"
struct lua_State;
@ -15,6 +16,7 @@ public:
private:
void reset(juce::String script);
static int handleLuaError(lua_State* L);
void parse();
static int panic(lua_State* L);