From addf72fcc01274ca72d00b61fd390d06f2191662 Mon Sep 17 00:00:00 2001 From: Sergey Avdeev Date: Tue, 8 Jun 2021 14:54:51 +0300 Subject: [PATCH] Support inline comments --- LIP.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/LIP.lua b/LIP.lua index aecdb14..f84f85d 100644 --- a/LIP.lua +++ b/LIP.lua @@ -39,8 +39,9 @@ function LIP.load(fileName) section = tonumber(tempSection) and tonumber(tempSection) or tempSection; data[section] = data[section] or {}; end - local param, value = line:match('^([%w|_]+)%s-=%s-(.+)$'); + local param, value = line:match('^([%w|_]+)%s*=%s*(.*)[\r]?$'); if(param and value ~= nil)then + value = value:match('^(.-)%s-;.-$') or value:match('^(.-)%s-$'); if(tonumber(value))then value = tonumber(value); elseif(value == 'true')then @@ -77,4 +78,4 @@ function LIP.save(fileName, data) file:close(); end -return LIP; \ No newline at end of file +return LIP;