From 863983202ce4ef92d9e3a296a682535d157c245d Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 23 Jun 2018 17:22:23 -0700 Subject: Fixed up nomsupath behavior and refactored file stuff into its own file. --- parser.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'parser.lua') diff --git a/parser.lua b/parser.lua index c04e95c..ad81252 100644 --- a/parser.lua +++ b/parser.lua @@ -132,7 +132,15 @@ do Parser.version = tonumber(v) end }) - local peg_file = io.open("nomsu.peg") or (package.nomsupath and io.open(package.nomsupath .. "/nomsu.peg")) + local peg_file = io.open("nomsu.peg") + if not peg_file and package.nomsupath then + for path in package.nomsupath:gmatch("[^;]+") do + peg_file = io.open(path .. "/nomsu.peg") + if peg_file then + break + end + end + end assert(peg_file, "could not find nomsu.peg file") local nomsu_peg = peg_tidier:match(peg_file:read('*a')) peg_file:close() -- cgit v1.2.3