Fixed rank:print()

This commit is contained in:
Cooldude2606
2017-12-11 18:31:38 +00:00
parent 1859b9ca9b
commit 9feda46d5e
3 changed files with 13 additions and 6 deletions

View File

@@ -218,14 +218,15 @@ function Ranking._rank:print(rtn)
else
-- using threads to make less lag
local thread = Server.new_thread{data={rank=self,rtn=rtn}}
thread.on_event('resolve',function(thread)
return self.data:get_players(true)
thread:on_event('resolve',function(thread)
return thread.data.rank:get_players(true)
end)
thread.on_event('success',function(thread,players)
thread:on_event('success',function(thread,players)
for _,player in pairs(players) do
player_return(rtn,player)
player_return(thread.data.rtn,player)
end
end)
thread:queue()
end
end

View File

@@ -203,6 +203,12 @@ function Server._thread:create(obj)
return obj
end
-- see Server.queue_thread - this just opens it first
function Server._thread:queue()
self:open()
return Server.queue_thread(self)
end
--- Test if the thread has all requied parts
-- @usage if thread:valid() then end
-- @tparam bolean skip_location_check true to skip the location check
@@ -291,7 +297,7 @@ function Server._thread:resolve(...)
Server.interface(function(thread,err)
local success,err = pcall(thread._success,thread,err)
if not success then thread:error(err) end
end,true,err)
end,true,self,err)
_return = true
end
else

View File

@@ -491,7 +491,7 @@ end
function table.autokey(tbl,str)
local _return = {}
for key,value in pairs(tbl) do
if string.contains(string.lower(str),string.lower(key)) then table.insert(_return,value) end
if string.contains(string.lower(key),string.lower(str)) then table.insert(_return,value) end
end
return _return[1] or false
end