kopia lustrzana https://github.com/jameshball/osci-render
Start getting useful error messages for Lua
rodzic
90fcd085be
commit
e3ecb794b0
|
@ -29,7 +29,10 @@ void LuaParser::parse() {
|
||||||
const int ret = luaL_loadstring(L, script.toUTF8());
|
const int ret = luaL_loadstring(L, script.toUTF8());
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
const char* error = lua_tostring(L, -1);
|
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);
|
lua_pop(L, 1);
|
||||||
functionRef = -1;
|
functionRef = -1;
|
||||||
if (script != fallbackScript) {
|
if (script != fallbackScript) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <JuceHeader.h>
|
#include <JuceHeader.h>
|
||||||
|
#include <regex>
|
||||||
#include "../shape/Shape.h"
|
#include "../shape/Shape.h"
|
||||||
|
|
||||||
struct lua_State;
|
struct lua_State;
|
||||||
|
@ -15,6 +16,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void reset(juce::String script);
|
void reset(juce::String script);
|
||||||
|
static int handleLuaError(lua_State* L);
|
||||||
void parse();
|
void parse();
|
||||||
|
|
||||||
static int panic(lua_State* L);
|
static int panic(lua_State* L);
|
||||||
|
|
Ładowanie…
Reference in New Issue