-- Trim whitespace from both ends function string_utils.trim(str) return str:match("^%s*(.-)%s*$") end
-- Read entire file as string (returns nil + error on failure) function file_utils.read_file(filename) local f, err = io.open(filename, "r") if not f then return nil, err end local content = f:read("*all") f:close() return content end script luar
-- Merge table t2 into t1 (overwrites t1 keys) function table_utils.merge(t1, t2) for k, v in pairs(t2) do t1[k] = v end return t1 end -- Trim whitespace from both ends function string_utils