From 1d92fcf28b1bb136abdd04cd2582a4c4d25f0c24 Mon Sep 17 00:00:00 2001 From: luk3yx Date: Sat, 5 Feb 2022 20:45:34 +1300 Subject: [PATCH] Fix scrollbar value --- README.md | 4 ++++ elements.lua | 2 +- elements.yaml | 2 +- make_elements.py | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ef48256..43fbf03 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,10 @@ all attributes are lowercase. While I try to reduce backwards incompatibilities, sometimes they are necessary to either fix bugs in formspec_ast or for implementing new formspec features. +### February 2022 + + - The value of scrollbars is now a number instead of a string. + #### March 2021 - The `index_event` value for `dropdown` is now a boolean instead of a string. diff --git a/elements.lua b/elements.lua index 823a73e..b2c0fd3 100644 --- a/elements.lua +++ b/elements.lua @@ -57,4 +57,4 @@ a[50] = {{a[49]}} a[51] = {{"prop", "table"}, "..."} a[52] = {a[21]} a[53] = {{{{{"selectors", "string"}, "..."}}, a[51]}, {a[52], a[51]}} -return {["formspec_version"] = {{{"version", "number"}}}, ["size"] = {{a[3]}, {{a[1], a[2], {"fixed_size", "boolean"}}}}, ["position"] = a[5], ["anchor"] = a[5], ["padding"] = a[5], ["no_prepend"] = a[7], ["real_coordinates"] = {{{"bool", "boolean"}}}, ["container"] = a[5], ["container_end"] = a[7], ["scroll_container"] = {{a[4], a[3], a[8], a[9], {"scroll_factor", "number"}}, {a[4], a[3], a[8], a[9]}}, ["scroll_container_end"] = a[7], ["list"] = {{a[10], a[11], a[4], a[3], {"starting_item_index", "number"}}, {a[10], a[11], a[4], a[3]}}, ["listring"] = {{a[10], a[11]}, a[6]}, ["listcolors"] = {{a[12], a[13], a[14], {"tooltip_bgcolor", "string"}, {"tooltip_fontcolor", "string"}}, {a[12], a[13], a[14]}, {a[12], a[13]}}, ["tooltip"] = {{a[4], a[3], a[15], a[16], a[17]}, {a[4], a[3], a[15], a[16]}, {a[18], a[15], a[16], a[17]}, {a[4], a[3], a[15]}, {a[18], a[15], a[16]}, {a[18], a[15]}}, ["image"] = {a[20]}, ["animated_image"] = {{a[4], a[3], a[21], a[19], a[22], a[23], {"frame_start", "number"}}, {a[4], a[3], a[21], a[19], a[22], a[23]}}, ["model"] = {{a[4], a[3], a[21], a[24], a[25], a[26], a[27], a[28], a[29], {"animation_speed", "number"}}, {a[4], a[3], a[21], a[24], a[25], a[26], a[27], a[28], a[29]}, {a[4], a[3], a[21], a[24], a[25], a[26], a[27], a[28]}, {a[4], a[3], a[21], a[24], a[25], a[26], a[27]}, {a[4], a[3], a[21], a[24], a[25], a[26]}, {a[4], a[3], a[21], a[24], a[25]}}, ["item_image"] = {{a[4], a[3], a[30]}}, ["bgcolor"] = {{a[16], a[31], {"fbgcolor", "string"}}, {a[16], a[31]}, {a[16]}}, ["background"] = {{a[4], a[3], a[19], a[32]}, a[20]}, ["background9"] = {{a[4], a[3], a[19], a[32], {a[33], a[34], {"middle_x2", "number"}, {"middle_y2", "number"}}}, {a[4], a[3], a[19], a[32], {a[33], a[34]}}, {a[4], a[3], a[19], a[32], {a[33]}}}, ["pwdfield"] = a[36], ["field"] = {a[38], {a[21], a[35], a[37]}}, ["field_close_on_enter"] = {{a[21], {"close_on_enter", "boolean"}}}, ["textarea"] = {a[38]}, ["label"] = a[39], ["hypertext"] = {{a[4], a[3], a[21], {"text", "string"}}}, ["vertlabel"] = a[39], ["button"] = a[36], ["image_button"] = {{a[4], a[3], a[19], a[21], a[35], {"noclip", "boolean"}, {"drawborder", "boolean"}, {"pressed_texture_name", "string"}}, a[40]}, ["item_image_button"] = {{a[4], a[3], a[30], a[21], a[35]}}, ["button_exit"] = a[36], ["image_button_exit"] = {a[40]}, ["textlist"] = {{a[4], a[3], a[21], a[41], a[42], a[43]}, {a[4], a[3], a[21], a[41], a[42]}, {a[4], a[3], a[21], a[41]}}, ["tabheader"] = {{a[4], a[2], a[21], a[44], a[45], a[43], a[46]}, {a[4], a[3], a[21], a[44], a[45], a[43], a[46]}, {a[4], a[21], a[44], a[45], a[43], a[46]}, {a[4], a[2], a[21], a[44], a[45], a[43]}, {a[4], a[3], a[21], a[44], a[45], a[43]}, {a[4], a[21], a[44], a[45], a[43]}, {a[4], a[2], a[21], a[44], a[45]}, {a[4], a[3], a[21], a[44], a[45]}, {a[4], a[21], a[44], a[45]}}, ["box"] = {{a[4], a[3], {"color", "string"}}}, ["dropdown"] = {{a[4], a[3], a[21], a[47], a[42], a[48]}, {a[4], a[1], a[21], a[47], a[42], a[48]}, {a[4], a[3], a[21], a[47], a[42]}, {a[4], a[1], a[21], a[47], a[42]}}, ["checkbox"] = {{a[4], a[21], a[35], {"selected", "boolean"}}, {a[4], a[21], a[35]}}, ["scrollbar"] = {{a[4], a[3], a[9], a[21], {"value", "string"}}}, ["scrollbaroptions"] = a[50], ["table"] = {{a[4], a[3], a[21], {{{"cells", "string"}, "..."}}, a[42]}}, ["tableoptions"] = a[50], ["tablecolumns"] = {{{{{"type", "string"}, a[49]}, "..."}}}, ["style"] = a[53], ["style_type"] = a[53], ["set_focus"] = {{a[21], {"force", "boolean"}}, a[52]}} +return {["formspec_version"] = {{{"version", "number"}}}, ["size"] = {{a[3]}, {{a[1], a[2], {"fixed_size", "boolean"}}}}, ["position"] = a[5], ["anchor"] = a[5], ["padding"] = a[5], ["no_prepend"] = a[7], ["real_coordinates"] = {{{"bool", "boolean"}}}, ["container"] = a[5], ["container_end"] = a[7], ["scroll_container"] = {{a[4], a[3], a[8], a[9], {"scroll_factor", "number"}}, {a[4], a[3], a[8], a[9]}}, ["scroll_container_end"] = a[7], ["list"] = {{a[10], a[11], a[4], a[3], {"starting_item_index", "number"}}, {a[10], a[11], a[4], a[3]}}, ["listring"] = {{a[10], a[11]}, a[6]}, ["listcolors"] = {{a[12], a[13], a[14], {"tooltip_bgcolor", "string"}, {"tooltip_fontcolor", "string"}}, {a[12], a[13], a[14]}, {a[12], a[13]}}, ["tooltip"] = {{a[4], a[3], a[15], a[16], a[17]}, {a[4], a[3], a[15], a[16]}, {a[18], a[15], a[16], a[17]}, {a[4], a[3], a[15]}, {a[18], a[15], a[16]}, {a[18], a[15]}}, ["image"] = {a[20]}, ["animated_image"] = {{a[4], a[3], a[21], a[19], a[22], a[23], {"frame_start", "number"}}, {a[4], a[3], a[21], a[19], a[22], a[23]}}, ["model"] = {{a[4], a[3], a[21], a[24], a[25], a[26], a[27], a[28], a[29], {"animation_speed", "number"}}, {a[4], a[3], a[21], a[24], a[25], a[26], a[27], a[28], a[29]}, {a[4], a[3], a[21], a[24], a[25], a[26], a[27], a[28]}, {a[4], a[3], a[21], a[24], a[25], a[26], a[27]}, {a[4], a[3], a[21], a[24], a[25], a[26]}, {a[4], a[3], a[21], a[24], a[25]}}, ["item_image"] = {{a[4], a[3], a[30]}}, ["bgcolor"] = {{a[16], a[31], {"fbgcolor", "string"}}, {a[16], a[31]}, {a[16]}}, ["background"] = {{a[4], a[3], a[19], a[32]}, a[20]}, ["background9"] = {{a[4], a[3], a[19], a[32], {a[33], a[34], {"middle_x2", "number"}, {"middle_y2", "number"}}}, {a[4], a[3], a[19], a[32], {a[33], a[34]}}, {a[4], a[3], a[19], a[32], {a[33]}}}, ["pwdfield"] = a[36], ["field"] = {a[38], {a[21], a[35], a[37]}}, ["field_close_on_enter"] = {{a[21], {"close_on_enter", "boolean"}}}, ["textarea"] = {a[38]}, ["label"] = a[39], ["hypertext"] = {{a[4], a[3], a[21], {"text", "string"}}}, ["vertlabel"] = a[39], ["button"] = a[36], ["image_button"] = {{a[4], a[3], a[19], a[21], a[35], {"noclip", "boolean"}, {"drawborder", "boolean"}, {"pressed_texture_name", "string"}}, a[40]}, ["item_image_button"] = {{a[4], a[3], a[30], a[21], a[35]}}, ["button_exit"] = a[36], ["image_button_exit"] = {a[40]}, ["textlist"] = {{a[4], a[3], a[21], a[41], a[42], a[43]}, {a[4], a[3], a[21], a[41], a[42]}, {a[4], a[3], a[21], a[41]}}, ["tabheader"] = {{a[4], a[2], a[21], a[44], a[45], a[43], a[46]}, {a[4], a[3], a[21], a[44], a[45], a[43], a[46]}, {a[4], a[21], a[44], a[45], a[43], a[46]}, {a[4], a[2], a[21], a[44], a[45], a[43]}, {a[4], a[3], a[21], a[44], a[45], a[43]}, {a[4], a[21], a[44], a[45], a[43]}, {a[4], a[2], a[21], a[44], a[45]}, {a[4], a[3], a[21], a[44], a[45]}, {a[4], a[21], a[44], a[45]}}, ["box"] = {{a[4], a[3], {"color", "string"}}}, ["dropdown"] = {{a[4], a[3], a[21], a[47], a[42], a[48]}, {a[4], a[1], a[21], a[47], a[42], a[48]}, {a[4], a[3], a[21], a[47], a[42]}, {a[4], a[1], a[21], a[47], a[42]}}, ["checkbox"] = {{a[4], a[21], a[35], {"selected", "boolean"}}, {a[4], a[21], a[35]}}, ["scrollbar"] = {{a[4], a[3], a[9], a[21], {"value", "number"}}}, ["scrollbaroptions"] = a[50], ["table"] = {{a[4], a[3], a[21], {{{"cells", "string"}, "..."}}, a[42]}}, ["tableoptions"] = a[50], ["tablecolumns"] = {{{{{"type", "string"}, a[49]}, "..."}}}, ["style"] = a[53], ["style_type"] = a[53], ["set_focus"] = {{a[21], {"force", "boolean"}}, a[52]}} diff --git a/elements.yaml b/elements.yaml index fe1e998..958696a 100644 --- a/elements.yaml +++ b/elements.yaml @@ -351,7 +351,7 @@ scrollbar: - [h, number] - [orientation, string] - [name, string] - - [value, string] + - [value, number] scrollbaroptions: - - - [opt, table] - '...' diff --git a/make_elements.py b/make_elements.py index 93cf2b0..ff152ff 100755 --- a/make_elements.py +++ b/make_elements.py @@ -16,7 +16,7 @@ def _make_known(**kwargs): _known = _make_known( number=('x', 'y', 'w', 'h', 'selected_idx', 'version', 'starting_item_index', 'scroll_factor', 'frame_count', - 'frame_duration', 'frame_start', 'animation_speed'), + 'frame_duration', 'frame_start', 'animation_speed', 'value'), boolean=('auto_clip', 'fixed_size', 'transparent', 'draw_border', 'bool', 'noclip', 'drawborder', 'selected', 'force', 'close_on_enter', 'continuous', 'mouse_control', 'index_event'),