diff --git a/locale/ExpCore/ranking.lua b/locale/ExpCore/ranking.lua index 55305e53..502fa114 100644 --- a/locale/ExpCore/ranking.lua +++ b/locale/ExpCore/ranking.lua @@ -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 diff --git a/locale/ExpCore/server.lua b/locale/ExpCore/server.lua index 4d6cd7d9..8b04a5ff 100644 --- a/locale/ExpCore/server.lua +++ b/locale/ExpCore/server.lua @@ -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 diff --git a/locale/StdLib/table.lua b/locale/StdLib/table.lua index 6f5c8166..66a9f6cd 100644 --- a/locale/StdLib/table.lua +++ b/locale/StdLib/table.lua @@ -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 \ No newline at end of file