diff --git a/luals/TAL/library/array.lua b/luals/TAL/library/array.lua index b1b184c..8ede8c8 100644 --- a/luals/TAL/library/array.lua +++ b/luals/TAL/library/array.lua @@ -31,8 +31,8 @@ function arrays.append(self, ...) end --- Adds all the given elements to the end of this array --- @generic T ---- @param self T[] ---- @param ... T[] +--- @param self array +--- @param ... T --- @return self function arrays.push(self, ...) end diff --git a/luals/TAL/library/mod/evn-loop.lua b/luals/TAL/library/mod/evn-loop.lua new file mode 100644 index 0000000..56df61e --- /dev/null +++ b/luals/TAL/library/mod/evn-loop.lua @@ -0,0 +1,18 @@ +--- @meta promise + +local exports = {}; + +--- Adds a message on the event loop to be executed later +--- @param ... fun() +function exports.push(...) end + +--- Adds the "main" function as a message and starts execution of the event loop (unless it's already running) +--- The "main" function is called with the given arguments +--- @param main fun(...) +function exports.run(main, ...) end + +--- Will suspend the execution of the current message and will continue to the next +--- Tip: saving the current thread with "coro.running()" and then transferring back to it works +function exports.interrupt() end + +return exports; diff --git a/luals/TAL/library/mod/global.lua b/luals/TAL/library/mod/global.lua new file mode 100644 index 0000000..cb723fc --- /dev/null +++ b/luals/TAL/library/mod/global.lua @@ -0,0 +1,3 @@ +--- @meta global + +return _G; diff --git a/mod/promise.d.lua b/luals/TAL/library/mod/promise.lua similarity index 98% rename from mod/promise.d.lua rename to luals/TAL/library/mod/promise.lua index 11f930c..41d3c15 100644 --- a/mod/promise.d.lua +++ b/luals/TAL/library/mod/promise.lua @@ -3,7 +3,7 @@ --- @alias promise promiselib | { when: fun(ful: fun(p1: T1, p2: T2, p3: T3, p4: T4, p5: T5, p6: T6, p7: T7, p8: T8, p9: T9, p10: T10), rej: fun(err)) } --- @class promiselib -promise = {}; +local promise = {}; promise.__index = promise; --- @generic T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 diff --git a/luals/TAL/library/string.lua b/luals/TAL/library/string.lua index 436d916..9ed98be 100644 --- a/luals/TAL/library/string.lua +++ b/luals/TAL/library/string.lua @@ -1,6 +1,5 @@ --- @meta - --- Splits the given string with the given delimiter --- @param self string --- @param sep string The delimiter to split by. Defaults to an empty string diff --git a/luals/TAL/library/utils.lua b/luals/TAL/library/utils.lua index 3979bc0..0024ab8 100644 --- a/luals/TAL/library/utils.lua +++ b/luals/TAL/library/utils.lua @@ -3,6 +3,7 @@ box = table.pack; unbox = table.unpack; exit = os.exit; +promise = require "promise"; --- @param box table --- @param s? number