From 67d882819b908d8178a890c12a1734de8ba7cf12 Mon Sep 17 00:00:00 2001 From: olive Date: Fri, 25 Sep 2026 17:42:35 +0100 Subject: Remove partial() from config.lua --- config.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'config.lua') diff --git a/config.lua b/config.lua index c4e78d3..866382f 100644 --- a/config.lua +++ b/config.lua @@ -1,4 +1,3 @@ -local function partial(f,x) return function(...) return f(x,...) end end local function kv_syntax(block,line) local k,v = line:match"^([a-z0-9_-]+)%s*=%s*(.*)$" @@ -22,7 +21,8 @@ local schema = { local function parse_file(file) local blocks = {} for k in pairs(schema) do blocks[k] = {} end - local line_handler = function() error("line outside of block") end + local line_handler = function(block,line) error("line outside of block") end + local block for line in file:lines() do line = line:gsub(";.*$",""):gsub("^%s*",""):gsub("%s*$","") @@ -31,11 +31,11 @@ local function parse_file(file) local block_type, block_name = line:match"%[%s*(%S+)%s+(%S+)%s*%]" if block_type then local blocks_of_this_type = assert(blocks[block_type],"no such block type "..block_type) - local block = {} + block = {} blocks_of_this_type[block_name] = block - line_handler = partial(schema[block_type], block) + line_handler = schema[block_type] else - line_handler(line) + line_handler(block, line) end ::next:: end -- cgit v1.2.3