Bump to 2.0.0, Added nil return, added rockspec (#2)

* Added rockspec file
* Added rock build action
* Added explicit `nil` return
* Bumped to v2.0.0
This commit is contained in:
2026-04-12 08:54:22 +02:00
committed by GitHub
parent 241dd14e57
commit 8b7e3c86d8
5 changed files with 65 additions and 2 deletions
+2 -1
View File
@@ -25,7 +25,7 @@ jobs:
- name: Preparing build directory
run: |
mkdir -p build/lua/doc
mkdir -p build/lua/doc/../lua
- name: Build LDoc documentation
uses: lunarmodules/ldoc@v1.5.0
@@ -38,6 +38,7 @@ jobs:
cp LICENSE build/LICENSE
cp demo.lua build/demo.lua
cp -R doc/ build/doc/
cp -R lua/ build/lua/
cp LICENSE build/doc/topics/LICENSE
- name: Upload artifact (socket.7z)
+36
View File
@@ -0,0 +1,36 @@
name: Build & Upload Rockspec
on:
push:
branches: master
workflow_dispatch:
concurrency:
group: rockspec-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Git submodules
uses: actions/checkout@v6
with:
submodules: true
fetch-depth: 0
- name: Install LuaRocks & build
run: |
sudo apt-get install -y luarocks
luarocks pack sleep-2.0.0-1.rockspec
- name: Upload rock artifact
uses: actions/upload-artifact@v4
if: ${{ github.ref == 'refs/heads/master' }}
with:
name: rockspec-artifact
path: "*.rock"
compression-level: 0
retention-days: 30
+1
View File
@@ -23,3 +23,4 @@ scripts/luapack.lua
*.packed.lua
*.lua.bin
*.lua.raw
*.rock
+5 -1
View File
@@ -5,7 +5,7 @@
-- @license CC0 1.0 Universal (CC0 1.0) (Public Domain)
-- @copyright 2026
--
-- @release 1.0.0
-- @release 2.0.0
-- Setup
@@ -85,6 +85,7 @@ end
--- Sleeps for a given amount of milliseconds and returns. \
--- May be interrupted by the OS.
--- @param milliseconds number Amount of milliseconds to sleep.
--- @return nil
function M.sleep_ms(milliseconds)
if milliseconds < 0 then
if M.ignore_errors then
@@ -110,11 +111,14 @@ function M.sleep_ms(milliseconds)
else
error("Library must be used on Win32 or Linux platforms ! (os: " .. ffi.os .. ")")
end
return nil
end
--- Sleeps for a given amount of seconds and returns. \
--- May be interrupted by the OS.
--- @param seconds number Amount of seconds to sleep.
--- @return nil
function M.sleep_s(seconds)
return M.sleep_ms(seconds * 1000)
end
+21
View File
@@ -0,0 +1,21 @@
package = "sleep"
version = "2.0.0-1"
source = {
url = "https://github.com/aziascreations/LuaJIT-Sleep/archive/refs/tags/v2.0.0.tar.gz",
dir = "LuaJIT-Sleep-2.0.0",
}
description = {
summary = "Pure LuaJIT bindings and wrappers for Win32 and Linux sleep functions.",
detailed = "Module that exposes millisecond and second precision sleep functions for Linux and Windows without having to compile anything.",
homepage = "https://github.com/aziascreations/LuaJIT-Sleep",
license = "CC0 1.0 Universal"
}
dependencies = {
"lua >= 5.1"
}
build = {
type = "builtin",
modules = {
sleep = "sleep.lua"
},
}