diff options
author | chai <chaifix@163.com> | 2021-10-30 11:32:16 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-10-30 11:32:16 +0800 |
commit | 42ec7286b2d36a9ba22925f816a17cb1cc2aa5ce (patch) | |
tree | 24bc7009457a8d7500f264e89946dc20d069294f /Data/Libraries/Penlight/examples/test-listcallbacks.lua | |
parent | 164885fd98d48703bd771f802d79557b7db97431 (diff) |
+ Penlight
Diffstat (limited to 'Data/Libraries/Penlight/examples/test-listcallbacks.lua')
-rw-r--r-- | Data/Libraries/Penlight/examples/test-listcallbacks.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Data/Libraries/Penlight/examples/test-listcallbacks.lua b/Data/Libraries/Penlight/examples/test-listcallbacks.lua new file mode 100644 index 0000000..a9a31c3 --- /dev/null +++ b/Data/Libraries/Penlight/examples/test-listcallbacks.lua @@ -0,0 +1,11 @@ +-- demonstrates how to use a list of callbacks +local List = require 'pl.List' +local utils = require 'pl.utils' +local actions = List() +local L = utils.string_lambda + +actions:append(function() print 'hello' end) +actions:append(L '|| print "yay"') + +-- '()' is a shortcut for operator.call or function(x) return x() end +actions:foreach '()' |