██████╗ ███████╗███████╗██████╗ ███████╗██████╗
██╔══██╗██╔════╝██╔════╝██╔══██╗██╔════╝██╔══██╗
██║ ██║█████╗ █████╗ ██████╔╝█████╗ ██████╔╝
██║ ██║██╔══╝ ██╔══╝ ██╔═══╝ ██╔══╝ ██║██╚╗
██████╔╝███████╗███████╗██║ ███████╗██║╗██║
╚═════╝ ╚══════╝╚══════╝╚═╝ ╚══════╝╚═╝ ╚═╝
deeper is a modification of deep that allows for multiple queues.
Place deeper.lua
inside your project and require it:
deeper = require "deeper"
newqueue = deeper.init()
newqueue.queue(3, print, "wound!")
newqueue.queue(1, print, "It's just")
newqueue.queue(2, print, "a flesh")
newqueue.execute()
Prints:
It's just
a flesh
wound!
Returns a queue.
newqueue = deeper.init()
Queues a function for execution at index i
[queue].queue(100, print, "Hello")
-- or
[queue].queue(100, function() print("Hello") end)
Arguments:
i
(number)
- The index of the action. Can be negative or positive.fun
(function)
- An anonymous or named function...
(*)
- The arguments of the passed named function
Usage:
-
With anonymous functions:
[queue].queue(30, function() hit(iron, 100) end)
-
With named functions:
[queue].queue(30, hit, iron, 100)
-
With multiple functions:
[queue].queue(30, function() hit(iron, 100) strike(steel, 200) end)
Executes all of the queued actions
-- Will execute the actions in random order
[queue].queue(math.random(10), print, "'Tis")
[queue].queue(math.random(10), print, "but")
[queue].queue(math.random(10), print, "a")
[queue].queue(math.random(10), print, "scratch!")
[queue].execute()
Deeper can do anything that deep can do, so please view the page for deep for examples.