123456789101112131415161718192021222324252627282930313233343536373839404142 |
- local function parse_int(str)
- local negative = string.match(str, "[%-]")
- local num = string.match(str, "[%d]+")
- local sign = (negative and -1) or 1
- local value = 0
- for d in string.gmatch(num or "", "%d")
- do
- value = value * 10 + d
- end
- return sign * value, type(num) == "string"
- end
- function map_making_toolkit.parse_args(param)
- local vectors = {}
- local i = 1
- for str in string.gmatch(param, "([%-%d]+)")
- do
- local n, worked = parse_int(str)
- if not worked
- then
- return false
- end
- vectors[i] = n
- i = i + 1
- end
- if not i == 7
- then
- return false
- end
- return true,
- vector.new(vectors[1], vectors[2], vectors[3]),
- vector.new(vectors[4], vectors[5], vectors[6])
- end
|