diff options
author | Emil Renner Berthing <esmil@mailme.dk> | 2012-07-31 18:29:52 +0200 |
---|---|---|
committer | Emil Renner Berthing <esmil@mailme.dk> | 2012-07-31 18:47:58 +0200 |
commit | 526c253d57b2daed8a122d56a0532dc1e7e83b40 (patch) | |
tree | 40931fb575b078caec04fa4ec204861436698914 /test | |
parent | 9db0a1b8d4539fe5f7aa678e0ef8fb634fb48bf7 (diff) | |
download | lem-526c253d57b2daed8a122d56a0532dc1e7e83b40.tar.gz lem-526c253d57b2daed8a122d56a0532dc1e7e83b40.tar.xz lem-526c253d57b2daed8a122d56a0532dc1e7e83b40.zip |
utils: remove timer function
Diffstat (limited to 'test')
-rwxr-xr-x | test/test.lua | 9 | ||||
-rwxr-xr-x | test/test2.lua | 16 |
2 files changed, 18 insertions, 7 deletions
diff --git a/test/test.lua b/test/test.lua index 57d76f2..8402e05 100755 --- a/test/test.lua +++ b/test/test.lua @@ -23,11 +23,18 @@ local function sleep(n) utils.sleeper():sleep(n) end +local function timer(n, f, ...) + utils.spawn(function(...) + sleep(n) + return f(...) + end, ...) +end + --print('package.cpath = ', package.cpath) print 'Saying booh in 2.5 seconds' -utils.timer(2.5, function() print 'Booh!' end) +timer(2.5, function() print 'Booh!' end) print 'Sleeping 5 seconds' diff --git a/test/test2.lua b/test/test2.lua index b64eedf..4988a0b 100755 --- a/test/test2.lua +++ b/test/test2.lua @@ -26,15 +26,19 @@ local function sleep(n) end print 'Saying "Fee!" in 1 second' -utils.timer(1, function() print 'Fee!' end) +utils.spawn(function() + sleep(1) + print 'Fee!' +end) print 'Saying "Fo!" in 3 seconds' -utils.timer(3, function() print 'Fo!' end) - utils.spawn(function() - print 'Sleeping for 2 seconds, then saying "Fi!" before the script ends' - sleep(2) - print 'Fi!' + sleep(3) + print 'Fo!' end) +print 'Sleeping for 2 seconds, then saying "Fi!" before the script ends' +sleep(2) +print 'Fi!' + -- vim: syntax=lua ts=3 sw=3 et: |