From fb64a264148ef7d2d3151318953d3774bb5318ad Mon Sep 17 00:00:00 2001 From: NullBite Date: Sun, 20 Mar 2022 22:27:25 -0400 Subject: [PATCH] Add EmmyLua annotations to utility functions --- script.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/script.lua b/script.lua index 4731410..f2b0c6f 100644 --- a/script.lua +++ b/script.lua @@ -5,7 +5,9 @@ TEXTURE_WIDTH = 128 TEXTURE_HEIGHT = 128 -- utility functions -- {{{ ---- dump table -- + +--- Create a string representation of a table +--- @param o table function dumpTable(o) if type(o) == 'table' then local s = '{ ' @@ -19,6 +21,7 @@ function dumpTable(o) end end +---@param uv table function UV(uv) return vectors.of({ uv[1]/TEXTURE_WIDTH, @@ -27,6 +30,8 @@ function UV(uv) end +---@param inputstr string +---@param sep string function splitstring (inputstr, sep) if sep == nil then sep = "%s" @@ -38,6 +43,7 @@ function splitstring (inputstr, sep) return t end +---@param input string function unstring(input) if input=="nil" then return nil @@ -50,6 +56,8 @@ function unstring(input) end end +---@param func function +---@param table table function map(func, table) local t={} for k, v in pairs(table) do @@ -58,6 +66,8 @@ function map(func, table) return t end +---@param func function +---@param table table function filter(func, table) local t={} for k, v in pairs(table) do