1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-13 16:56:49 +00:00

Petty changes because I'm petty

This commit is contained in:
SquidDev 2019-07-13 08:29:28 +01:00
parent 4b7d843b78
commit 4ae77261fa
2 changed files with 11 additions and 5 deletions

View File

@ -388,14 +388,14 @@ function create( parent, nX, nY, nWidth, nHeight, bStartVisible )
return nBackgroundColor
end
function window.getLine( nY )
if type(nY) ~= "number" then expect(1, nY, "number") end
function window.getLine(y)
if type(y) ~= "number" then expect(1, y, "number") end
if nY < 1 or nY > nHeight then
error( "Line is out of range.", 2 )
if y < 1 or y > nHeight then
error("Line is out of range.", 2)
end
return tLines[nY].text, tLines[nY].textColor, tLines[nY].backgroundColor
return tLines[y].text, tLines[y].textColor, tLines[y].backgroundColor
end
-- Other functions

View File

@ -130,5 +130,11 @@ describe("The window library", function()
expect.error(w.getLine, 0):eq("Line is out of range.")
expect.error(w.getLine, y + 1):eq("Line is out of range.")
end)
it("provides a line's contents", function()
local w = mk()
w.blit("test", "aaaa", "4444")
expect({ w.getLine(1) }):same { "test ", "aaaa0", "4444f" }
end)
end)
end)