aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThijs Schreijer <thijs@thijsschreijer.nl>2025-03-02 19:45:04 +0100
committerThijs Schreijer <thijs@thijsschreijer.nl>2025-03-02 19:50:39 +0100
commit9318a7dc9f7def35a2e9d85ccffe63c06950be09 (patch)
tree945278ce1ce56e225289204f13ac8528264bbb92
parent2981db32130b30c9b12e7347bfdbe2e7584e9274 (diff)
downloadluasystem-9318a7dc9f7def35a2e9d85ccffe63c06950be09.tar.gz
luasystem-9318a7dc9f7def35a2e9d85ccffe63c06950be09.tar.bz2
luasystem-9318a7dc9f7def35a2e9d85ccffe63c06950be09.zip
Release v0.5.0v0.5.0
-rw-r--r--CHANGELOG.md5
-rw-r--r--LICENSE.md2
-rw-r--r--docs/classes/bitflags.html2
-rw-r--r--docs/examples/compat.lua.html2
-rw-r--r--docs/examples/flag_debugging.lua.html2
-rw-r--r--docs/examples/password_input.lua.html2
-rw-r--r--docs/examples/read.lua.html2
-rw-r--r--docs/examples/readline.lua.html10
-rw-r--r--docs/examples/spinner.lua.html2
-rw-r--r--docs/examples/spiral_snake.lua.html2
-rw-r--r--docs/examples/terminalsize.lua.html2
-rw-r--r--docs/index.html2
-rw-r--r--docs/modules/system.html31
-rw-r--r--docs/topics/01-introduction.md.html2
-rw-r--r--docs/topics/02-development.md.html2
-rw-r--r--docs/topics/03-terminal.md.html10
-rw-r--r--docs/topics/CHANGELOG.md.html13
-rw-r--r--docs/topics/LICENSE.md.html4
-rw-r--r--rockspecs/luasystem-0.5.0-1.rockspec85
-rw-r--r--src/core.c2
20 files changed, 147 insertions, 37 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index af9a294..06ff748 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,14 +21,13 @@ The scope of what is covered by the version number excludes:
21- commit the changes as `Release vX.Y.Z` 21- commit the changes as `Release vX.Y.Z`
22- push the commit, and create a release PR 22- push the commit, and create a release PR
23- after merging tag the release commit with `vX.Y.Z` 23- after merging tag the release commit with `vX.Y.Z`
24- upload to LuaRocks:<br/> 24- upload to LuaRocks will be automatic by the CI runners
25 `luarocks upload ./rockspecs/luasystem-X.Y.Z-1.rockspec --api-key=ABCDEFGH`
26- test the newly created rock:<br/> 25- test the newly created rock:<br/>
27 `luarocks install luasystem` 26 `luarocks install luasystem`
28 27
29## Version history 28## Version history
30 29
31### unreleased 30### version 0.5.0, released 02-Mar-2025
32 31
33- Feat: when detecting character display width, also accept unicode codepoints (integers), 32- Feat: when detecting character display width, also accept unicode codepoints (integers),
34 since the Lua utf8 library returns codepoints, not strings 33 since the Lua utf8 library returns codepoints, not strings
diff --git a/LICENSE.md b/LICENSE.md
index 92f0bbb..4eba941 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,7 +1,7 @@
1# MIT License 1# MIT License
2 2
3### Copyright (c) 2016-2024, Oscar Lim 3### Copyright (c) 2016-2024, Oscar Lim
4### Copyright (c) 2024, the luasystem project authors. 4### Copyright (c) 2024-2025, the luasystem project authors.
5 5
6Permission is hereby granted, free of charge, to any person obtaining a copy of 6Permission is hereby granted, free of charge, to any person obtaining a copy of
7this software and associated documentation files (the "Software"), to deal in 7this software and associated documentation files (the "Software"), to deal in
diff --git a/docs/classes/bitflags.html b/docs/classes/bitflags.html
index 4ed5aaf..dc682f2 100644
--- a/docs/classes/bitflags.html
+++ b/docs/classes/bitflags.html
@@ -298,7 +298,7 @@ return <code>false</code> if the flags are checked.
298</div> <!-- id="main" --> 298</div> <!-- id="main" -->
299<div id="about"> 299<div id="about">
300<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> 300<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
301<i style="float:right;">Last updated 2024-12-18 02:50:03 </i> 301<i style="float:right;">Last updated 2025-03-02 19:43:40 </i>
302</div> <!-- id="about" --> 302</div> <!-- id="about" -->
303</div> <!-- id="container" --> 303</div> <!-- id="container" -->
304</body> 304</body>
diff --git a/docs/examples/compat.lua.html b/docs/examples/compat.lua.html
index b887c91..42928b0 100644
--- a/docs/examples/compat.lua.html
+++ b/docs/examples/compat.lua.html
@@ -112,7 +112,7 @@
112</div> <!-- id="main" --> 112</div> <!-- id="main" -->
113<div id="about"> 113<div id="about">
114<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> 114<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
115<i style="float:right;">Last updated 2024-12-18 02:50:03 </i> 115<i style="float:right;">Last updated 2025-03-02 19:43:40 </i>
116</div> <!-- id="about" --> 116</div> <!-- id="about" -->
117</div> <!-- id="container" --> 117</div> <!-- id="container" -->
118</body> 118</body>
diff --git a/docs/examples/flag_debugging.lua.html b/docs/examples/flag_debugging.lua.html
index 8fcf0a9..862cd96 100644
--- a/docs/examples/flag_debugging.lua.html
+++ b/docs/examples/flag_debugging.lua.html
@@ -80,7 +80,7 @@
80</div> <!-- id="main" --> 80</div> <!-- id="main" -->
81<div id="about"> 81<div id="about">
82<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> 82<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
83<i style="float:right;">Last updated 2024-12-18 02:50:03 </i> 83<i style="float:right;">Last updated 2025-03-02 19:43:40 </i>
84</div> <!-- id="about" --> 84</div> <!-- id="about" -->
85</div> <!-- id="container" --> 85</div> <!-- id="container" -->
86</body> 86</body>
diff --git a/docs/examples/password_input.lua.html b/docs/examples/password_input.lua.html
index f29e429..cf27497 100644
--- a/docs/examples/password_input.lua.html
+++ b/docs/examples/password_input.lua.html
@@ -132,7 +132,7 @@ useful for reading secrets from the user.
132</div> <!-- id="main" --> 132</div> <!-- id="main" -->
133<div id="about"> 133<div id="about">
134<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> 134<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
135<i style="float:right;">Last updated 2024-12-18 02:50:03 </i> 135<i style="float:right;">Last updated 2025-03-02 19:43:40 </i>
136</div> <!-- id="about" --> 136</div> <!-- id="about" -->
137</div> <!-- id="container" --> 137</div> <!-- id="container" -->
138</body> 138</body>
diff --git a/docs/examples/read.lua.html b/docs/examples/read.lua.html
index 1d6bb3e..2ffcf1b 100644
--- a/docs/examples/read.lua.html
+++ b/docs/examples/read.lua.html
@@ -143,7 +143,7 @@ sys.<span class="function-name">setnonblock</span>(<span class="global">io</span
143</div> <!-- id="main" --> 143</div> <!-- id="main" -->
144<div id="about"> 144<div id="about">
145<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> 145<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
146<i style="float:right;">Last updated 2024-12-18 02:50:03 </i> 146<i style="float:right;">Last updated 2025-03-02 19:43:40 </i>
147</div> <!-- id="about" --> 147</div> <!-- id="about" -->
148</div> <!-- id="container" --> 148</div> <!-- id="container" -->
149</body> 149</body>
diff --git a/docs/examples/readline.lua.html b/docs/examples/readline.lua.html
index a78f5b3..ba453ad 100644
--- a/docs/examples/readline.lua.html
+++ b/docs/examples/readline.lua.html
@@ -213,10 +213,12 @@ readline.__index = readline
213</span><span class="comment">-- @tparam[opt=""] string opts.value the default value 213</span><span class="comment">-- @tparam[opt=""] string opts.value the default value
214</span><span class="comment">-- @tparam[opt=<code>#value</code>] number opts.position of the cursor in the input 214</span><span class="comment">-- @tparam[opt=<code>#value</code>] number opts.position of the cursor in the input
215</span><span class="comment">-- @tparam[opt={"\10"/"\13"}] table opts.exit_keys an array of keys that will cause the readline to exit 215</span><span class="comment">-- @tparam[opt={"\10"/"\13"}] table opts.exit_keys an array of keys that will cause the readline to exit
216</span><span class="comment">-- @tparam[opt=system.sleep] function opts.fsleep the sleep function to use (see <a href="../modules/system.html#readansi">system.readansi</a>)
216</span><span class="comment">-- @treturn readline the new readline object 217</span><span class="comment">-- @treturn readline the new readline object
217</span><span class="keyword">function</span> readline.<span class="function-name">new</span>(opts) 218</span><span class="keyword">function</span> readline.<span class="function-name">new</span>(opts)
218 <span class="keyword">local</span> value = <span class="function-name">utf8parse</span>(opts.value <span class="keyword">or</span> <span class="string">""</span>) 219 <span class="keyword">local</span> value = <span class="function-name">utf8parse</span>(opts.value <span class="keyword">or</span> <span class="string">""</span>)
219 <span class="keyword">local</span> prompt = <span class="function-name">utf8parse</span>(opts.prompt <span class="keyword">or</span> <span class="string">""</span>) 220 <span class="keyword">local</span> prompt = <span class="function-name">utf8parse</span>(opts.prompt <span class="keyword">or</span> <span class="string">""</span>)
221 <span class="keyword">local</span> fsleep = opts.fsleep <span class="keyword">or</span> sys.sleep
220 <span class="keyword">local</span> pos = <span class="global">math</span>.<span class="function-name">floor</span>(opts.position <span class="keyword">or</span> (#value + <span class="number">1</span>)) 222 <span class="keyword">local</span> pos = <span class="global">math</span>.<span class="function-name">floor</span>(opts.position <span class="keyword">or</span> (#value + <span class="number">1</span>))
221 pos = <span class="global">math</span>.<span class="function-name">max</span>(<span class="global">math</span>.<span class="function-name">min</span>(pos, (#value + <span class="number">1</span>)), <span class="number">1</span>) 223 pos = <span class="global">math</span>.<span class="function-name">max</span>(<span class="global">math</span>.<span class="function-name">min</span>(pos, (#value + <span class="number">1</span>)), <span class="number">1</span>)
222 <span class="keyword">local</span> len = <span class="global">math</span>.<span class="function-name">floor</span>(opts.max_length <span class="keyword">or</span> <span class="number">80</span>) 224 <span class="keyword">local</span> len = <span class="global">math</span>.<span class="function-name">floor</span>(opts.max_length <span class="keyword">or</span> <span class="number">80</span>)
@@ -244,6 +246,7 @@ readline.__index = readline
244</span> position = pos, <span class="comment">-- the current position in the input 246</span> position = pos, <span class="comment">-- the current position in the input
245</span> drawn_before = <span class="keyword">false</span>, <span class="comment">-- if the prompt has been drawn 247</span> drawn_before = <span class="keyword">false</span>, <span class="comment">-- if the prompt has been drawn
246</span> exit_keys = exit_keys, <span class="comment">-- the keys that will cause the readline to exit 248</span> exit_keys = exit_keys, <span class="comment">-- the keys that will cause the readline to exit
249</span> fsleep = fsleep, <span class="comment">-- the sleep function to use
247</span> } 250</span> }
248 251
249 <span class="global">setmetatable</span>(self, readline) 252 <span class="global">setmetatable</span>(self, readline)
@@ -482,7 +485,7 @@ readline.__index = readline
482 <span class="keyword">local</span> timeout_end = sys.<span class="function-name">gettime</span>() + timeout 485 <span class="keyword">local</span> timeout_end = sys.<span class="function-name">gettime</span>() + timeout
483 486
484 <span class="keyword">while</span> <span class="keyword">true</span> <span class="keyword">do</span> 487 <span class="keyword">while</span> <span class="keyword">true</span> <span class="keyword">do</span>
485 <span class="keyword">local</span> key, keytype = sys.<span class="function-name">readansi</span>(timeout_end - sys.<span class="function-name">gettime</span>()) 488 <span class="keyword">local</span> key, keytype = sys.<span class="function-name">readansi</span>(timeout_end - sys.<span class="function-name">gettime</span>(), self.fsleep)
486 <span class="keyword">if</span> <span class="keyword">not</span> key <span class="keyword">then</span> 489 <span class="keyword">if</span> <span class="keyword">not</span> key <span class="keyword">then</span>
487 <span class="comment">-- error or timeout 490 <span class="comment">-- error or timeout
488</span> <span class="keyword">return</span> <span class="keyword">nil</span>, keytype 491</span> <span class="keyword">return</span> <span class="keyword">nil</span>, keytype
@@ -527,7 +530,8 @@ sys.<span class="function-name">setconsoleflags</span>(<span class="global">io</
527 value = <span class="string">"Hello, 你-好 World 🚀!"</span>, 530 value = <span class="string">"Hello, 你-好 World 🚀!"</span>,
528 <span class="comment">-- position = 2, 531 <span class="comment">-- position = 2,
529</span> exit_keys = {key_sequences.enter, <span class="string">"\27"</span>, <span class="string">"\t"</span>, <span class="string">"\27[Z"</span>}, <span class="comment">-- enter, escape, tab, shift-tab 532</span> exit_keys = {key_sequences.enter, <span class="string">"\27"</span>, <span class="string">"\t"</span>, <span class="string">"\27[Z"</span>}, <span class="comment">-- enter, escape, tab, shift-tab
530</span>} 533</span> fsleep = sys.sleep,
534}
531 535
532 536
533<span class="keyword">local</span> result, key = <span class="function-name">rl</span>() 537<span class="keyword">local</span> result, key = <span class="function-name">rl</span>()
@@ -545,7 +549,7 @@ sys.<span class="function-name">setconsoleflags</span>(<span class="global">io</
545</div> <!-- id="main" --> 549</div> <!-- id="main" -->
546<div id="about"> 550<div id="about">
547<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> 551<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
548<i style="float:right;">Last updated 2024-12-18 02:50:03 </i> 552<i style="float:right;">Last updated 2025-03-02 19:43:40 </i>
549</div> <!-- id="about" --> 553</div> <!-- id="about" -->
550</div> <!-- id="container" --> 554</div> <!-- id="container" -->
551</body> 555</body>
diff --git a/docs/examples/spinner.lua.html b/docs/examples/spinner.lua.html
index b56f1ed..ea992e3 100644
--- a/docs/examples/spinner.lua.html
+++ b/docs/examples/spinner.lua.html
@@ -137,7 +137,7 @@ sys.<span class="function-name">setnonblock</span>(<span class="global">io</span
137</div> <!-- id="main" --> 137</div> <!-- id="main" -->
138<div id="about"> 138<div id="about">
139<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> 139<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
140<i style="float:right;">Last updated 2024-12-18 02:50:03 </i> 140<i style="float:right;">Last updated 2025-03-02 19:43:40 </i>
141</div> <!-- id="about" --> 141</div> <!-- id="about" -->
142</div> <!-- id="container" --> 142</div> <!-- id="container" -->
143</body> 143</body>
diff --git a/docs/examples/spiral_snake.lua.html b/docs/examples/spiral_snake.lua.html
index 961f506..1f0d582 100644
--- a/docs/examples/spiral_snake.lua.html
+++ b/docs/examples/spiral_snake.lua.html
@@ -145,7 +145,7 @@ codes for moving the cursor around.
145</div> <!-- id="main" --> 145</div> <!-- id="main" -->
146<div id="about"> 146<div id="about">
147<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> 147<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
148<i style="float:right;">Last updated 2024-12-18 02:50:03 </i> 148<i style="float:right;">Last updated 2025-03-02 19:43:40 </i>
149</div> <!-- id="about" --> 149</div> <!-- id="about" -->
150</div> <!-- id="container" --> 150</div> <!-- id="container" -->
151</body> 151</body>
diff --git a/docs/examples/terminalsize.lua.html b/docs/examples/terminalsize.lua.html
index c01a3d3..a8bb42b 100644
--- a/docs/examples/terminalsize.lua.html
+++ b/docs/examples/terminalsize.lua.html
@@ -110,7 +110,7 @@ sys.<span class="function-name">tcsetattr</span>(<span class="global">io</span>.
110</div> <!-- id="main" --> 110</div> <!-- id="main" -->
111<div id="about"> 111<div id="about">
112<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> 112<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
113<i style="float:right;">Last updated 2024-12-18 02:50:03 </i> 113<i style="float:right;">Last updated 2025-03-02 19:43:40 </i>
114</div> <!-- id="about" --> 114</div> <!-- id="about" -->
115</div> <!-- id="container" --> 115</div> <!-- id="container" -->
116</body> 116</body>
diff --git a/docs/index.html b/docs/index.html
index 1ddd617..9ca0c42 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -142,7 +142,7 @@
142</div> <!-- id="main" --> 142</div> <!-- id="main" -->
143<div id="about"> 143<div id="about">
144<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> 144<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
145<i style="float:right;">Last updated 2024-12-18 02:50:03 </i> 145<i style="float:right;">Last updated 2025-03-02 19:43:40 </i>
146</div> <!-- id="about" --> 146</div> <!-- id="about" -->
147</div> <!-- id="container" --> 147</div> <!-- id="container" -->
148</body> 148</body>
diff --git a/docs/modules/system.html b/docs/modules/system.html
index ec077d8..093fd8b 100644
--- a/docs/modules/system.html
+++ b/docs/modules/system.html
@@ -152,12 +152,12 @@
152 <td class="summary">Debug function for terminal flags (Posix).</td> 152 <td class="summary">Debug function for terminal flags (Posix).</td>
153 </tr> 153 </tr>
154 <tr> 154 <tr>
155 <td class="name" nowrap><a href="#readansi">readansi (timeout)</a></td> 155 <td class="name" nowrap><a href="#readansi">readansi (timeout[, fsleep=system.sleep])</a></td>
156 <td class="summary">Reads a single key, if it is the start of ansi escape sequence then it reads 156 <td class="summary">Reads a single key, if it is the start of ansi escape sequence then it reads
157 the full sequence.</td> 157 the full sequence.</td>
158 </tr> 158 </tr>
159 <tr> 159 <tr>
160 <td class="name" nowrap><a href="#readkey">readkey (timeout)</a></td> 160 <td class="name" nowrap><a href="#readkey">readkey (timeout[, fsleep=system.sleep])</a></td>
161 <td class="summary">Reads a single byte from the console, with a timeout.</td> 161 <td class="summary">Reads a single byte from the console, with a timeout.</td>
162 </tr> 162 </tr>
163 <tr> 163 <tr>
@@ -353,7 +353,8 @@ Windows, setting an empty string, will also delete the variable)
353 </dt> 353 </dt>
354 <dd> 354 <dd>
355 Generate random bytes. 355 Generate random bytes.
356This uses <code>CryptGenRandom()</code> on Windows, and <code>/dev/urandom</code> on other platforms. It will return the 356This uses <code>BCryptGenRandom()</code> on Windows, <code>getrandom()</code> on Linux, <code>arc4random_buf</code> on BSD,
357and <code>/dev/urandom</code> on other platforms. It will return the
357requested number of bytes, or an error, never a partial result. 358requested number of bytes, or an error, never a partial result.
358 359
359 360
@@ -728,12 +729,12 @@ system.<span class="function-name">listconsoleflags</span>(<span class="global">
728</dd> 729</dd>
729 <dt> 730 <dt>
730 <a name = "readansi"></a> 731 <a name = "readansi"></a>
731 <strong>readansi (timeout)</strong> 732 <strong>readansi (timeout[, fsleep=system.sleep])</strong>
732 </dt> 733 </dt>
733 <dd> 734 <dd>
734 Reads a single key, if it is the start of ansi escape sequence then it reads 735 Reads a single key, if it is the start of ansi escape sequence then it reads
735 the full sequence. The key can be a multi-byte string in case of multibyte UTF-8 character. 736 the full sequence. The key can be a multi-byte string in case of multibyte UTF-8 character.
736 This function uses <a href="../modules/system.html#readkey">system.readkey</a>, and hence <a href="../modules/system.html#sleep">system.sleep</a> to wait until either a key is 737 This function uses <a href="../modules/system.html#readkey">system.readkey</a>, and hence <code>fsleep</code> to wait until either a key is
737 available or the timeout is reached. 738 available or the timeout is reached.
738 It returns immediately if a key is available or if <code>timeout</code> is less than or equal to <code>0</code>. 739 It returns immediately if a key is available or if <code>timeout</code> is less than or equal to <code>0</code>.
739 In case of an ANSI sequence, it will return the full sequence as a string. 740 In case of an ANSI sequence, it will return the full sequence as a string.
@@ -745,6 +746,11 @@ system.<span class="function-name">listconsoleflags</span>(<span class="global">
745 <span class="types"><span class="type">number</span></span> 746 <span class="types"><span class="type">number</span></span>
746 the timeout in seconds. 747 the timeout in seconds.
747 </li> 748 </li>
749 <li><span class="parameter">fsleep</span>
750 <span class="types"><span class="type">function</span></span>
751 the function to call for sleeping.
752 (<em>default</em> system.sleep)
753 </li>
748 </ul> 754 </ul>
749 755
750 <h3>Returns:</h3> 756 <h3>Returns:</h3>
@@ -775,11 +781,11 @@ system.<span class="function-name">listconsoleflags</span>(<span class="global">
775</dd> 781</dd>
776 <dt> 782 <dt>
777 <a name = "readkey"></a> 783 <a name = "readkey"></a>
778 <strong>readkey (timeout)</strong> 784 <strong>readkey (timeout[, fsleep=system.sleep])</strong>
779 </dt> 785 </dt>
780 <dd> 786 <dd>
781 Reads a single byte from the console, with a timeout. 787 Reads a single byte from the console, with a timeout.
782 This function uses <a href="../modules/system.html#sleep">system.sleep</a> to wait until either a byte is available or the timeout is reached. 788 This function uses <code>fsleep</code> to wait until either a byte is available or the timeout is reached.
783 The sleep period is exponentially backing off, starting at 0.0125 seconds, with a maximum of 0.2 seconds. 789 The sleep period is exponentially backing off, starting at 0.0125 seconds, with a maximum of 0.2 seconds.
784 It returns immediately if a byte is available or if <code>timeout</code> is less than or equal to <code>0</code>.</p> 790 It returns immediately if a byte is available or if <code>timeout</code> is less than or equal to <code>0</code>.</p>
785 791
@@ -793,6 +799,11 @@ system.<span class="function-name">listconsoleflags</span>(<span class="global">
793 <span class="types"><span class="type">number</span></span> 799 <span class="types"><span class="type">number</span></span>
794 the timeout in seconds. 800 the timeout in seconds.
795 </li> 801 </li>
802 <li><span class="parameter">fsleep</span>
803 <span class="types"><span class="type">function</span></span>
804 the function to call for sleeping.
805 (<em>default</em> system.sleep)
806 </li>
796 </ul> 807 </ul>
797 808
798 <h3>Returns:</h3> 809 <h3>Returns:</h3>
@@ -1261,8 +1272,8 @@ flags for the <code>iflags</code>, <code>oflags</code>, and <code>lflags</code>
1261 <h3>Parameters:</h3> 1272 <h3>Parameters:</h3>
1262 <ul> 1273 <ul>
1263 <li><span class="parameter">utf8_char</span> 1274 <li><span class="parameter">utf8_char</span>
1264 <span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.4">string</a></span> 1275 <span class="types"><a class="type" href="https://www.lua.org/manual/5.4/manual.html#6.4">string</a> or <span class="type">int</span></span>
1265 the utf8 character to check, only the width of the first character will be returned 1276 the utf8 character, or unicode codepoint, to check, only the width of the first character will be returned
1266 </li> 1277 </li>
1267 </ul> 1278 </ul>
1268 1279
@@ -1411,7 +1422,7 @@ This function will sleep, without doing a busy-loop and wasting CPU cycles.
1411</div> <!-- id="main" --> 1422</div> <!-- id="main" -->
1412<div id="about"> 1423<div id="about">
1413<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> 1424<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
1414<i style="float:right;">Last updated 2024-12-18 02:50:03 </i> 1425<i style="float:right;">Last updated 2025-03-02 19:43:40 </i>
1415</div> <!-- id="about" --> 1426</div> <!-- id="about" -->
1416</div> <!-- id="container" --> 1427</div> <!-- id="container" -->
1417</body> 1428</body>
diff --git a/docs/topics/01-introduction.md.html b/docs/topics/01-introduction.md.html
index 5b5f07d..cf8a21f 100644
--- a/docs/topics/01-introduction.md.html
+++ b/docs/topics/01-introduction.md.html
@@ -84,7 +84,7 @@ independence.</p>
84</div> <!-- id="main" --> 84</div> <!-- id="main" -->
85<div id="about"> 85<div id="about">
86<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> 86<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
87<i style="float:right;">Last updated 2024-12-18 02:50:03 </i> 87<i style="float:right;">Last updated 2025-03-02 19:43:40 </i>
88</div> <!-- id="about" --> 88</div> <!-- id="about" -->
89</div> <!-- id="container" --> 89</div> <!-- id="container" -->
90</body> 90</body>
diff --git a/docs/topics/02-development.md.html b/docs/topics/02-development.md.html
index b305201..b9f79fd 100644
--- a/docs/topics/02-development.md.html
+++ b/docs/topics/02-development.md.html
@@ -84,7 +84,7 @@ pass locally, and do not rely on CI only.</p>
84</div> <!-- id="main" --> 84</div> <!-- id="main" -->
85<div id="about"> 85<div id="about">
86<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> 86<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
87<i style="float:right;">Last updated 2024-12-18 02:50:03 </i> 87<i style="float:right;">Last updated 2025-03-02 19:43:40 </i>
88</div> <!-- id="about" --> 88</div> <!-- id="about" -->
89</div> <!-- id="container" --> 89</div> <!-- id="container" -->
90</body> 90</body>
diff --git a/docs/topics/03-terminal.md.html b/docs/topics/03-terminal.md.html
index 6471a30..8c45d6e 100644
--- a/docs/topics/03-terminal.md.html
+++ b/docs/topics/03-terminal.md.html
@@ -202,10 +202,10 @@ sys.<span class="function-name">tcsetattr</span>(<span class="global">io</span>.
202sys.<span class="function-name">setnonblock</span>(<span class="global">io</span>.stdin, <span class="keyword">true</span>) 202sys.<span class="function-name">setnonblock</span>(<span class="global">io</span>.stdin, <span class="keyword">true</span>)
203</pre> 203</pre>
204 204
205<p>Both functions require a timeout to be provided which allows for proper asynchronous 205<p>Both <code>readkey</code> and <code>readansi</code> require a timeout to be provided which allows for proper asynchronous
206code to be written. Since the underlying sleep method used is <a href="../modules/system.html#sleep">system.sleep</a>, just patching 206code to be written. The underlying sleep method to use can be provided, and defaults to <a href="../modules/system.html#sleep">system.sleep</a>.
207that function with a coroutine based yielding one should be all that is needed to make 207Just passing a coroutine enabled sleep method should be all that is needed to make
208the result work with asynchroneous coroutine schedulers.</p> 208the result work with asynchroneous coroutine schedulers. Alternatively just patch <a href="../modules/system.html#sleep">system.sleep</a>.</p>
209 209
210<h3>3.3.2 Blocking input</h3> 210<h3>3.3.2 Blocking input</h3>
211 211
@@ -218,7 +218,7 @@ For an example see <a href="../examples/password_input.lua.html"><code>examples/
218</div> <!-- id="main" --> 218</div> <!-- id="main" -->
219<div id="about"> 219<div id="about">
220<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> 220<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
221<i style="float:right;">Last updated 2024-12-18 02:50:03 </i> 221<i style="float:right;">Last updated 2025-03-02 19:43:40 </i>
222</div> <!-- id="about" --> 222</div> <!-- id="about" -->
223</div> <!-- id="container" --> 223</div> <!-- id="container" -->
224</body> 224</body>
diff --git a/docs/topics/CHANGELOG.md.html b/docs/topics/CHANGELOG.md.html
index 8567695..fd3ba59 100644
--- a/docs/topics/CHANGELOG.md.html
+++ b/docs/topics/CHANGELOG.md.html
@@ -107,6 +107,17 @@
107<p><a name="Version_history"></a></p> 107<p><a name="Version_history"></a></p>
108<h2>Version history</h2> 108<h2>Version history</h2>
109 109
110<h3>unreleased</h3>
111
112<ul>
113 <li>Feat: when detecting character display width, also accept unicode codepoints (integers),
114 since the Lua utf8 library returns codepoints, not strings</li>
115 <li>Feat: allow passing in a sleep function to <code>readkey</code> and <code>readansi</code></li>
116 <li>Fix: NetBSD fix compilation, undeclared directives</li>
117 <li>Refactor: random bytes; remove deprecated API usage on Windows, move to
118 binary api instead of /dev/urandom file on linux and bsd</li>
119</ul>
120
110<h3>version 0.4.5, released 18-Dec-2024</h3> 121<h3>version 0.4.5, released 18-Dec-2024</h3>
111 122
112<ul> 123<ul>
@@ -183,7 +194,7 @@
183</div> <!-- id="main" --> 194</div> <!-- id="main" -->
184<div id="about"> 195<div id="about">
185<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> 196<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
186<i style="float:right;">Last updated 2024-12-18 02:50:03 </i> 197<i style="float:right;">Last updated 2025-03-02 19:43:40 </i>
187</div> <!-- id="about" --> 198</div> <!-- id="about" -->
188</div> <!-- id="container" --> 199</div> <!-- id="container" -->
189</body> 200</body>
diff --git a/docs/topics/LICENSE.md.html b/docs/topics/LICENSE.md.html
index 1fe8797..bbe229e 100644
--- a/docs/topics/LICENSE.md.html
+++ b/docs/topics/LICENSE.md.html
@@ -69,7 +69,7 @@
69<h1>MIT License</h1> 69<h1>MIT License</h1>
70 70
71<h3>Copyright (c) 2016-2024, Oscar Lim</h3> 71<h3>Copyright (c) 2016-2024, Oscar Lim</h3>
72<h3>Copyright (c) 2024, the luasystem project authors.</h3> 72<h3>Copyright (c) 2024-2025, the luasystem project authors.</h3>
73 73
74<p>Permission is hereby granted, free of charge, to any person obtaining a copy of 74<p>Permission is hereby granted, free of charge, to any person obtaining a copy of
75this software and associated documentation files (the "Software"), to deal in 75this software and associated documentation files (the "Software"), to deal in
@@ -94,7 +94,7 @@ SOFTWARE.</p>
94</div> <!-- id="main" --> 94</div> <!-- id="main" -->
95<div id="about"> 95<div id="about">
96<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i> 96<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
97<i style="float:right;">Last updated 2024-12-18 02:50:03 </i> 97<i style="float:right;">Last updated 2025-03-02 19:43:40 </i>
98</div> <!-- id="about" --> 98</div> <!-- id="about" -->
99</div> <!-- id="container" --> 99</div> <!-- id="container" -->
100</body> 100</body>
diff --git a/rockspecs/luasystem-0.5.0-1.rockspec b/rockspecs/luasystem-0.5.0-1.rockspec
new file mode 100644
index 0000000..4fc9b5c
--- /dev/null
+++ b/rockspecs/luasystem-0.5.0-1.rockspec
@@ -0,0 +1,85 @@
1local package_name = "luasystem"
2local package_version = "0.5.0"
3local rockspec_revision = "1"
4local github_account_name = "lunarmodules"
5local github_repo_name = "luasystem"
6
7
8package = package_name
9version = package_version.."-"..rockspec_revision
10
11source = {
12 url = "git+https://github.com/"..github_account_name.."/"..github_repo_name..".git",
13 branch = (package_version == "scm") and "master" or nil,
14 tag = (package_version ~= "scm") and "v"..package_version or nil,
15}
16
17description = {
18 summary = 'Platform independent system calls for Lua.',
19 detailed = [[
20 Adds a Lua API for making platform independent system calls.
21 ]],
22 license = 'MIT <http://opensource.org/licenses/MIT>',
23 homepage = "https://github.com/"..github_account_name.."/"..github_repo_name,
24}
25
26dependencies = {
27 'lua >= 5.1',
28}
29
30local function make_platform(plat)
31 local defines = {
32 linux = { },
33 unix = { },
34 macosx = { },
35 win32 = { "WINVER=0x0600", "_WIN32_WINNT=0x0600" },
36 mingw32 = { "WINVER=0x0600", "_WIN32_WINNT=0x0600" },
37 }
38 local libraries = {
39 linux = { "rt" },
40 unix = { },
41 macosx = { },
42 win32 = { "advapi32", "winmm", "bcrypt" },
43 mingw32 = { },
44 }
45 local libdirs = {
46 linux = nil,
47 unix = nil,
48 macosx = nil,
49 win32 = nil,
50 mingw32 = { },
51 }
52 return {
53 modules = {
54 ['system.core'] = {
55 sources = {
56 'src/core.c',
57 'src/compat.c',
58 'src/time.c',
59 'src/environment.c',
60 'src/random.c',
61 'src/term.c',
62 'src/bitflags.c',
63 'src/wcwidth.c',
64 },
65 defines = defines[plat],
66 libraries = libraries[plat],
67 libdirs = libdirs[plat],
68 },
69 },
70 }
71end
72
73build = {
74 type = 'builtin',
75 platforms = {
76 linux = make_platform('linux'),
77 unix = make_platform('unix'),
78 macosx = make_platform('macosx'),
79 win32 = make_platform('win32'),
80 mingw32 = make_platform('mingw32'),
81 },
82 modules = {
83 ['system.init'] = 'system/init.lua',
84 },
85}
diff --git a/src/core.c b/src/core.c
index 06ae3e1..4eaa448 100644
--- a/src/core.c
+++ b/src/core.c
@@ -4,7 +4,7 @@
4#include <lua.h> 4#include <lua.h>
5#include <lauxlib.h> 5#include <lauxlib.h>
6 6
7#define LUASYSTEM_VERSION "LuaSystem 0.4.5" 7#define LUASYSTEM_VERSION "LuaSystem 0.5.0"
8 8
9#ifdef _WIN32 9#ifdef _WIN32
10#define LUAEXPORT __declspec(dllexport) 10#define LUAEXPORT __declspec(dllexport)