Skip to content

Commit

Permalink
Fix CallbackController callback function arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonomit committed Jun 22, 2022
1 parent 991e414 commit 702b545
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions ItemCache.lua
Original file line number Diff line number Diff line change
Expand Up @@ -545,26 +545,28 @@ local callbackControllerMeta = {
__tostring = function(self) return "CallbackController" end,
}
local function MakeCallbackController(_, items, retrieveMode, callback, ...)
local callbackController = {...}
local queue = {}
for id, suffixItems in pairs(items) do
for suffix, item in pairs(suffixItems) do
tblinsert(queue, item)
end
end
setPrivate(callbackController, {
items = items,
queue = Queue(queue),
Retrieve = retrieveModes[retrieveMode].Retrieve,
IsRetrieved = retrieveModes[retrieveMode].IsRetrieved,
callback = callback,
itemsRemaining = #queue,
max = #queue,
speed = 1,
suspended = false,
cancelled = false,
})
return setmetatable(callbackController, callbackControllerMeta)

local callbackControllerPrivate = {...}
callbackControllerPrivate.items = items;
callbackControllerPrivate.queue = Queue(queue);
callbackControllerPrivate.Retrieve = retrieveModes[retrieveMode].Retrieve;
callbackControllerPrivate.IsRetrieved = retrieveModes[retrieveMode].IsRetrieved;
callbackControllerPrivate.callback = callback;
callbackControllerPrivate.itemsRemaining = #queue;
callbackControllerPrivate.max = #queue;
callbackControllerPrivate.speed = 1;
callbackControllerPrivate.suspended = false;
callbackControllerPrivate.cancelled = false;

local callbackController = {}
setPrivate(callbackController, callbackControllerPrivate);
return setmetatable(callbackController, callbackControllerMeta);
end
setmetatable(CallbackController, {__call = MakeCallbackController})
function CallbackController:GetSize()
Expand Down

0 comments on commit 702b545

Please sign in to comment.