-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #362 from randovania/new-caption
Add async popup windows
- Loading branch information
Showing
5 changed files
with
240 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
Game.ImportLibrary("system/scripts/class.lua", false) | ||
|
||
---@class Queue | ||
---@field push fun(self: Queue, item: any) | ||
---@field peek fun(self: Queue): any | ||
---@field pop fun(self: Queue): any | ||
---@field empty fun(self: Queue): boolean | ||
|
||
---@type fun(): Queue | ||
Queue = class.New( | ||
---comment | ||
---@param inst Queue | ||
function(inst) | ||
inst.data = {} | ||
|
||
inst.first = 0 | ||
inst.last = -1 | ||
|
||
inst.push = function(self, item) | ||
self.last = self.last + 1 | ||
self.data[self.last] = item | ||
end | ||
|
||
inst.peek = function (self) | ||
if self:empty() then error("Trying to retrieve from an empty queue") end | ||
return self.data[self.first] | ||
end | ||
|
||
inst.pop = function(self) | ||
local value = self:peek() | ||
self.data[self.first] = nil | ||
self.first = self.first + 1 | ||
return value | ||
end | ||
|
||
inst.empty = function(self) | ||
return self.first > self.last | ||
end | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters