Add example docs for LDoc

This commit is contained in:
Insality
2019-09-25 20:40:41 +03:00
parent 4d424a34c2
commit b72e7451e1
14 changed files with 92 additions and 35 deletions

View File

@@ -1,3 +1,6 @@
--- Druid helper module for animating GUI nodes
-- @module helper.animate
local M = {}
local PROP_SCALE = gui.PROP_SCALE

View File

@@ -1,3 +1,7 @@
--- Druid inner module to acquire/release input
-- @module helper.input
-- @local
local M = {}
local ADD_FOCUS = hash("acquire_input_focus")

View File

@@ -1,10 +1,13 @@
--- Druid module with utils on string formats
-- @module helper.formats
local M = {}
local ZERO = "0"
-- Return number with zero number prefix
-- @param num - number for conversion
-- @param count - count of numerals
--- Return number with zero number prefix
-- @param num number for conversion
-- @param count count of numerals
-- @return string with need count of zero (1,3) -> 001
function M.add_prefix_zeros(num, count)
local result = tostring(num)
@@ -15,8 +18,8 @@ function M.add_prefix_zeros(num, count)
end
-- Convert seconds to string minutes:seconds
-- @param num - number of seconds
--- Convert seconds to string minutes:seconds
-- @param num number of seconds
-- @return string minutes:seconds
function M.second_string_min(sec)
local mins = math.floor(sec / 60)
@@ -25,11 +28,11 @@ function M.second_string_min(sec)
end
-- Interpolate string with named Parameters in Table
-- @param s - string for interpolate
-- @param tab - table with parameters
--- Interpolate string with named Parameters in Table
-- @param s string for interpolate
-- @param tab table with parameters
-- @return string with replaced parameters
function M.interpolate_strinng(s, tab)
function M.interpolate_string(s, tab)
return (s:gsub('($%b{})', function(w) return tab[w:sub(3, -2)] or w end))
end