aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--examples/terminalsize.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/terminalsize.lua b/examples/terminalsize.lua
index ed66792..105a415 100644
--- a/examples/terminalsize.lua
+++ b/examples/terminalsize.lua
@@ -24,13 +24,13 @@ local function cursor_move_horiz(n)
24end 24end
25 25
26 26
27local w, h 27local rows, cols
28print("Change the terminal window size, press any key to exit") 28print("Change the terminal window size, press any key to exit")
29while not sys.readansi(0.2) do -- use readansi to not leave stray bytes in the input buffer 29while not sys.readansi(0.2) do -- use readansi to not leave stray bytes in the input buffer
30 local nw, nh = sys.termsize() 30 local nrows, ncols = sys.termsize()
31 if w ~= nw or h ~= nh then 31 if rows ~= nrows or cols ~= ncols then
32 w, h = nw, nh 32 rows, cols = nrows, ncols
33 local text = "Terminal size: " .. w .. "x" .. h .. " " 33 local text = "Terminal size: " .. rows .. "x" .. cols .. " "
34 io.write(text .. cursor_move_horiz(-#text)) 34 io.write(text .. cursor_move_horiz(-#text))
35 io.flush() 35 io.flush()
36 end 36 end