Simplified object:method syntax for trim() and split()

This commit is contained in:
Charles Dang 2014-12-29 15:47:44 +11:00
parent fa079a1b3f
commit c762937e74

View file

@ -21,11 +21,11 @@ local wml_actions = wesnoth.wml_actions
local function trim(s)
-- use (f(a)) to get first argument
return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
return (s:gsub("^%s*(.-)%s*$", "%1"))
end
local function split(s)
return string.gmatch(s, "[^%s,][^,]*")
return s:gmatch("[^%s,][^,]*")
end
local function optional_side_filter(cfg, key_name, filter_name)