Skip to content

Commit

Permalink
.lua file loading testing
Browse files Browse the repository at this point in the history
  • Loading branch information
pd3v committed Jul 29, 2024
1 parent 43e81ed commit 410f630
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 7 additions & 4 deletions line.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,8 @@ class Parser {
std::ifstream input (parserFile.c_str());
textBuffer << input.rdbuf();
parserCode = textBuffer.str();

// std::cout << "parserCode->" << parserCode << std::endl;
}

~Parser() {lua_close(L);};

void reportLuaErrorsOnExit(lua_State *L, int status) {
Expand Down Expand Up @@ -171,12 +170,16 @@ class Parser {
// auto p = parserCode + " phrs_matching = lpeg.match(phraseG, \"" + _phrase +
// "\"); t = phrs_matching and phrs_matching or NO_MATCH";

auto p = parserCode;
auto p = parserCode + " phrs_matching = lpeg.match(phraseG, \"" + "(c3 e3 g3)~.1 (c4 cs4 d4)" +
"\"); t = phrs_matching and phrs_matching or NO_MATCH";
// r = phraseG:match("(c1 e1 g1)~.1 (c4 cs4 d4)")
// auto p = parserCode;
std::cout << p << '\n';

if (int luaError = luaL_dostring(L, p.c_str()) == LUA_OK) {
lua_getglobal(L, "t");

std::cout << "lua parser loaded\n";
std::cout << "<<<lua parser loaded>>>\n";

// 3D Lua table to c++ vector
if (lua_istable(L,-1)) {
Expand Down
1 change: 0 additions & 1 deletion lineparser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package.cpath = 'externals/?/lib?.dylib;externals/?/lib?.so;lib/lib?.dylib;lib/l
local lpeg = require 'lpeg'
local write = io.write
lpeg.locale(lpeg)
print(lpeg, "loaded?!")

local AMP_SYMBOL = "~"
local NO_MATCH = {{'e', {{255,0}}}}
Expand Down

0 comments on commit 410f630

Please sign in to comment.