From: Tobias Ulmer Date: Fri, 1 Feb 2013 18:51:29 +0000 (+0100) Subject: Rename arg in e2lib.parse_server_location(), add assert X-Git-Tag: e2factory-2.3.13rc1~30 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=68295fb64b9478727139858909772dc64e4264bb;p=e2factory.git Rename arg in e2lib.parse_server_location(), add assert arg is used as a hidden parameter by Lua. Signed-off-by: Tobias Ulmer --- diff --git a/generic/e2lib.lua b/generic/e2lib.lua index e8df45f..e4d87dd 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -1862,15 +1862,16 @@ function e2lib.read_template(file) end --- parse a server:location string, taking a default server into account --- @param arg string: the string to parse +-- @param serverloc string: the string to parse -- @param default_server string: the default server name -- @return a table with fields server and location, nil on error -- @return nil, an error string on error -function e2lib.parse_server_location(arg, default_server) +function e2lib.parse_server_location(serverloc, default_server) + assert(type(serverloc) == 'string' and type(default_server) == 'string') local sl = {} - sl.server, sl.location = arg:match("(%S+):(%S+)") + sl.server, sl.location = serverloc:match("(%S+):(%S+)") if not (sl.server and sl.location) then - sl.location = arg:match("(%S+)") + sl.location = serverloc:match("(%S+)") if not (sl.location and default_server) then return nil, "can't parse location" end