Working on 13.1.0
This commit is contained in:
parent
afee0ace94
commit
11cfb390bb
10
changes.md
10
changes.md
@ -1,5 +1,15 @@
|
|||||||
#Changes
|
#Changes
|
||||||
[TOC]
|
[TOC]
|
||||||
|
Update 13.1.0 Bug fixes and some new features (Will upgrade version to 14.0.0 if significant changes are made)
|
||||||
|
-------------
|
||||||
|
Added:
|
||||||
|
- Connections:Lock() -- Prevents a connection object form being fired
|
||||||
|
- Connections:Unlock() -- Removes the restriction imposed by conn:Lock()
|
||||||
|
|
||||||
|
Fixed:
|
||||||
|
- Minor bug with multi:newThread() in how names and functions were managed
|
||||||
|
-
|
||||||
|
|
||||||
Update 13.0.0 Added some documentation, and some new features too check it out!
|
Update 13.0.0 Added some documentation, and some new features too check it out!
|
||||||
-------------
|
-------------
|
||||||
**Quick note** on the 13.0.0 update:
|
**Quick note** on the 13.0.0 update:
|
||||||
|
|||||||
@ -24,8 +24,8 @@ SOFTWARE.
|
|||||||
local bin = pcall(require,"bin")
|
local bin = pcall(require,"bin")
|
||||||
local multi = {}
|
local multi = {}
|
||||||
local clock = os.clock
|
local clock = os.clock
|
||||||
multi.Version = "13.0.0"
|
multi.Version = "13.1.0"
|
||||||
multi._VERSION = "13.0.0"
|
multi._VERSION = "13.1.0"
|
||||||
multi.stage = "stable"
|
multi.stage = "stable"
|
||||||
multi.__index = multi
|
multi.__index = multi
|
||||||
multi.Name = "multi.root"
|
multi.Name = "multi.root"
|
||||||
@ -740,6 +740,7 @@ function multi:newConnection(protect,func)
|
|||||||
local c={}
|
local c={}
|
||||||
c.callback = func
|
c.callback = func
|
||||||
c.Parent=self
|
c.Parent=self
|
||||||
|
c.lock = false
|
||||||
setmetatable(c,{__call=function(self,...)
|
setmetatable(c,{__call=function(self,...)
|
||||||
local t = ...
|
local t = ...
|
||||||
if type(t)=="table" and t.Type ~= nil then
|
if type(t)=="table" and t.Type ~= nil then
|
||||||
@ -788,8 +789,15 @@ function multi:newConnection(protect,func)
|
|||||||
return self.connections[name] or self
|
return self.connections[name] or self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
function c:Lock()
|
||||||
|
c.lock = true
|
||||||
|
end
|
||||||
|
function c:Unlock()
|
||||||
|
c.lock = false
|
||||||
|
end
|
||||||
function c:Fire(...)
|
function c:Fire(...)
|
||||||
local ret={}
|
local ret={}
|
||||||
|
if self.lock then return end
|
||||||
for i=#self.func,1,-1 do
|
for i=#self.func,1,-1 do
|
||||||
if self.protect then
|
if self.protect then
|
||||||
local temp={pcall(self.func[i][1],...)}
|
local temp={pcall(self.func[i][1],...)}
|
||||||
@ -822,6 +830,7 @@ function multi:newConnection(protect,func)
|
|||||||
ID=self.ID,
|
ID=self.ID,
|
||||||
Parent=self,
|
Parent=self,
|
||||||
Fire=function(self,...)
|
Fire=function(self,...)
|
||||||
|
if self.Parent.lock then return end
|
||||||
--~ if self.Parent.FC>0 then
|
--~ if self.Parent.FC>0 then
|
||||||
--~ for i=1,#self.Parent.FC do
|
--~ for i=1,#self.Parent.FC do
|
||||||
--~ self.Parent.FC[i]:Fire(...)
|
--~ self.Parent.FC[i]:Fire(...)
|
||||||
@ -1497,9 +1506,8 @@ multi:setDomainName("Globals")
|
|||||||
local initT = false
|
local initT = false
|
||||||
local threadCount = 0
|
local threadCount = 0
|
||||||
function multi:newThread(name,func)
|
function multi:newThread(name,func)
|
||||||
local func = func
|
local func = func or name
|
||||||
if type(name) == "function" then
|
if type(name) == "function" then
|
||||||
func = name
|
|
||||||
name = "Thread#"..threadCount
|
name = "Thread#"..threadCount
|
||||||
end
|
end
|
||||||
local c={}
|
local c={}
|
||||||
|
|||||||
19
test.lua
19
test.lua
@ -2,8 +2,25 @@ package.path="?/init.lua;?.lua;"..package.path
|
|||||||
multi = require("multi")
|
multi = require("multi")
|
||||||
local GLOBAL,THREAD = require("multi.integration.lanesManager").init()
|
local GLOBAL,THREAD = require("multi.integration.lanesManager").init()
|
||||||
nGLOBAL = require("multi.integration.networkManager").init()
|
nGLOBAL = require("multi.integration.networkManager").init()
|
||||||
|
function table.print(tbl, indent)
|
||||||
|
if type(tbl)~="table" then return end
|
||||||
|
if not indent then indent = 0 end
|
||||||
|
for k, v in pairs(tbl) do
|
||||||
|
formatting = string.rep(' ', indent) .. k .. ': '
|
||||||
|
if type(v) == 'table' then
|
||||||
|
print(formatting)
|
||||||
|
table.print(v, indent+1)
|
||||||
|
else
|
||||||
|
print(formatting .. tostring(v))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
multi:newThread(function()
|
multi:newThread(function()
|
||||||
error("Did it work?")
|
while true do
|
||||||
|
thread.sleep(1)
|
||||||
|
print("-----")
|
||||||
|
multi:getTasksDetails("t")
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
multi.OnError(function(...)
|
multi.OnError(function(...)
|
||||||
print(...)
|
print(...)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user