put ass messages into a table to avoid reallocations
This commit is contained in:
parent
8f8edb25f6
commit
91ce054f42
|
@ -253,7 +253,7 @@ menu.update = function()
|
||||||
osd:tab():bold('o: '):append('Open `streamable.com`'):newline()
|
osd:tab():bold('o: '):append('Open `streamable.com`'):newline()
|
||||||
osd:tab():bold('ESC: '):append('Close'):newline()
|
osd:tab():bold('ESC: '):append('Close'):newline()
|
||||||
|
|
||||||
menu.overlay_draw(osd.text)
|
menu.overlay_draw(osd:get_text())
|
||||||
end
|
end
|
||||||
|
|
||||||
menu.close = function()
|
menu.close = function()
|
||||||
|
@ -279,11 +279,11 @@ OSD = {}
|
||||||
OSD.__index = OSD
|
OSD.__index = OSD
|
||||||
|
|
||||||
function OSD:new()
|
function OSD:new()
|
||||||
return setmetatable({ text = '' }, self)
|
return setmetatable({ text = {} }, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function OSD:append(s)
|
function OSD:append(s)
|
||||||
self.text = self.text .. s
|
table.insert(self.text, s)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -307,6 +307,10 @@ function OSD:align(number)
|
||||||
return self:append(string.format([[{\an%s}]], number))
|
return self:append(string.format([[{\an%s}]], number))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function OSD:get_text()
|
||||||
|
return table.concat(self.text)
|
||||||
|
end
|
||||||
|
|
||||||
------------------------------------------------------------
|
------------------------------------------------------------
|
||||||
-- Timings class
|
-- Timings class
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue