From b68dd2a38742636b0448b560415cd0f104aa1bfd Mon Sep 17 00:00:00 2001 From: VorTechnix <45538536+VorTechnix@users.noreply.github.com> Date: Fri, 14 Jul 2023 17:35:19 -0700 Subject: [PATCH] rename new parse functions --- worldeditadditions_core/utils/parse/axes_parser.lua | 12 +++++++++--- worldeditadditions_core/utils/parse/init.lua | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/worldeditadditions_core/utils/parse/axes_parser.lua b/worldeditadditions_core/utils/parse/axes_parser.lua index 9bcc00c..331c958 100644 --- a/worldeditadditions_core/utils/parse/axes_parser.lua +++ b/worldeditadditions_core/utils/parse/axes_parser.lua @@ -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).."\"." diff --git a/worldeditadditions_core/utils/parse/init.lua b/worldeditadditions_core/utils/parse/init.lua index b071db7..feeed19 100644 --- a/worldeditadditions_core/utils/parse/init.lua +++ b/worldeditadditions_core/utils/parse/init.lua @@ -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,