rename new parse functions

This commit is contained in:
VorTechnix 2023-07-14 17:35:19 -07:00
parent 714716ff32
commit b68dd2a387
No known key found for this signature in database
GPG key ID: 091E91A69545D5BA
2 changed files with 11 additions and 5 deletions

View file

@ -135,6 +135,8 @@ function parse.vectorize(axes,value,sign)
return ret
end
--- Converts Unified Axis Keyword table into Vector3 instances.
-- @param: tbl: Table: Keyword table to parse
-- @param: facing: Table: Output from worldeditadditions_core.player_dir(name)
@ -216,7 +218,11 @@ function parse.keytable(tbl, facing, sum)
self.axis, self.sign = "", 1
end
local function processNumber(num, axes, sign)
--- Processes a number and adds it to the min and max vectors.
-- @param num The number to process.
-- @param axes The axes to apply the number to.
-- @param sign The sign of the number.
local function parseNumber(num, axes, sign)
if num * sign >= 0 then
max = max:add(parse.vectorize(axes, num, sign))
else
@ -233,7 +239,7 @@ function parse.keytable(tbl, facing, sum)
if expected == 1 then
if tmp.num then
processNumber(tmp.num, {"x", "y", "z"}, tmp.sign)
parseNumber(tmp.num, {"x", "y", "z"}, tmp.sign)
else
local key_type, key_entry, key_sign = parse.keyword(v)
@ -253,7 +259,7 @@ function parse.keytable(tbl, facing, sum)
end
else
if tmp.num then
processNumber(tmp.num, tmp.axes, tmp.sign)
parseNumber(tmp.num, tmp.axes, tmp.sign)
expected = 1
else
return false, "Error: Expected number after \""..tostring(tbl[i-1]).."\". Got \""..tostring(v).."\"."

View file

@ -12,8 +12,8 @@ local uak_parse = dofile(wea_c.modpath.."/utils/parse/axes_parser.lua")
local axes = dofile(wea_c.modpath.."/utils/parse/axes.lua")
wea_c.parse = {
direction_keyword = uak_parse.keyword,
directions = uak_parse.keytable,
axis_name = uak_parse.keyword,
axes_multi = uak_parse.keytable,
-- Old parse functions (marked for deprecation).
-- Use parse.keytable or parse.keyword instead
axes = axes.parse_axes,