mirror of
https://github.com/rayaman/multi.git
synced 2026-09-05 07:27:35 -04:00
Added some new methods (1.7.6)
More examples small tweaks added/modified examples typos as always minor bug fixes some new features, read readme for them
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
require("core.Library")
|
||||
require("multi.compat.love2d") -- allows for multitasking and binds my libraies to the love2d engine that i am using
|
||||
GLOBAL,sThread=require("multi.intergration.loveManager").init() -- load the love2d version of the lanesManager
|
||||
GLOBAL,sThread=require("multi.intergration.loveManager").init() -- load the love2d version of the lanesManager and requires the entire multi library
|
||||
--IMPORTANT
|
||||
-- Do not make the above local, this is the one difference that the lanesManager does not have
|
||||
-- If these are local the functions will have the upvalues put into them that do not exist on the threaded side
|
||||
|
||||
@@ -45,7 +45,7 @@ function print(...)
|
||||
end
|
||||
end
|
||||
multi = {}
|
||||
multi.Version={1,7,5}
|
||||
multi.Version={1,7,6}
|
||||
multi.stage='stable'
|
||||
multi.__index = multi
|
||||
multi.Mainloop={}
|
||||
@@ -67,7 +67,7 @@ multi.jobUS=2
|
||||
multi.clock=os.clock
|
||||
multi.time=os.time
|
||||
multi.LinkedPath=multi
|
||||
mulit.isRunning=false
|
||||
multi.isRunning=false
|
||||
multi.queuefinal=function(self)
|
||||
self:Destroy()
|
||||
if self.Parent.Mainloop[#self.Parent.Mainloop] then
|
||||
@@ -239,6 +239,15 @@ end
|
||||
function multi:getVersion()
|
||||
return multi.Version[1].."."..multi.Version[2].."."..multi.Version[3]
|
||||
end
|
||||
function multi:getPlatform()
|
||||
if love then
|
||||
if love.thread then
|
||||
return "love2d"
|
||||
end
|
||||
else
|
||||
return "lanes"
|
||||
end
|
||||
end
|
||||
--Processor
|
||||
function multi:getError()
|
||||
if self.error then
|
||||
@@ -953,8 +962,8 @@ function multi:newCondition(func)
|
||||
end
|
||||
multi.NewCondition=multi.newCondition
|
||||
function multi:mainloop()
|
||||
if not mulit.isRunning then
|
||||
mulit.isRunning=true
|
||||
if not multi.isRunning then
|
||||
multi.isRunning=true
|
||||
for i=1,#self.Tasks do
|
||||
self.Tasks[i](self)
|
||||
end
|
||||
@@ -1020,6 +1029,9 @@ function multi:newEvent(task)
|
||||
end
|
||||
end
|
||||
end
|
||||
function c:SetTask(func)
|
||||
self.Task=func
|
||||
end
|
||||
function c:OnEvent(func)
|
||||
table.insert(self.func,func)
|
||||
end
|
||||
|
||||
@@ -31,7 +31,7 @@ end
|
||||
-- Step 1 get lanes
|
||||
lanes=require("lanes").configure()
|
||||
package.path="lua/?/init.lua;lua/?.lua;"..package.path
|
||||
require("multi.updater") -- get it all and have it on all lanes
|
||||
require("multi.all") -- get it all and have it on all lanes
|
||||
local multi=multi
|
||||
-- Step 2 set up the linda objects
|
||||
local __GlobalLinda = lanes.linda() -- handles global stuff
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
require("multi.compat.love2d")
|
||||
multi.intergration={}
|
||||
multi.intergration.love2d={}
|
||||
multi.intergration.love2d.ThreadBase=[[
|
||||
@@ -326,6 +327,7 @@ updater:OnUpdate(function(self)
|
||||
data=multi.intergration.love2d.mainChannel:pop()
|
||||
end
|
||||
end)
|
||||
print("Intergrated Love2d!")
|
||||
return {
|
||||
init=function(t)
|
||||
if t then
|
||||
|
||||
Reference in New Issue
Block a user