From ec8c8c7074dee619759634a8d6f3938ab2f5f42e Mon Sep 17 00:00:00 2001 From: Ryan Ward Date: Sat, 8 Feb 2020 08:50:44 -0500 Subject: [PATCH] Working on some new features --- multi/init.lua | 3 +++ test.lua | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/multi/init.lua b/multi/init.lua index 31f4cef..9a82eff 100644 --- a/multi/init.lua +++ b/multi/init.lua @@ -1220,6 +1220,9 @@ function multi:newTLoop(func,set) self:create(c) return c end +function multi:setTimeout(func,t) + multi:newThread(function() thread.sleep(t) func() end) +end function multi:newTrigger(func) local c={} c.Type='trigger' diff --git a/test.lua b/test.lua index 1326329..88409a2 100644 --- a/test.lua +++ b/test.lua @@ -3,6 +3,9 @@ multi,thread = require("multi"):init() multi.OnLoad(function() print("Code Loaded!") end) +multi:setTimeout(function() + print("here we are!") +end,2) local t co = 0 multi.OnExit(function(n) @@ -12,6 +15,12 @@ test = thread:newFunction(function() thread.sleep(1) return 1,math.random(2,100) end) +multi:newThread(function() + while true do + thread.sleep(.1) + print("!") + end +end) multi:newThread(function() t = os.clock() while true do