aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorThijs Schreijer <thijs@thijsschreijer.nl>2024-06-08 09:28:20 +0200
committerThijs Schreijer <thijs@thijsschreijer.nl>2024-06-08 09:28:20 +0200
commit8996a5022fa82e5d5335f71580d0cd6b6d323c9b (patch)
treeaac6b6a015cf06aad845627f51b739fe58f85166 /examples
parent52562e9986f8f5a4d2dda4333acba110734def0f (diff)
downloadluasystem-8996a5022fa82e5d5335f71580d0cd6b6d323c9b.tar.gz
luasystem-8996a5022fa82e5d5335f71580d0cd6b6d323c9b.tar.bz2
luasystem-8996a5022fa82e5d5335f71580d0cd6b6d323c9b.zip
switch termsize results to standard; rows, cols
Diffstat (limited to 'examples')
-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