--add the trim function function trim(s) return s:gsub("^%s+", ""):gsub("%s+$", "") end