diff --git a/.github/workflows/luacheck.yml b/.github/workflows/luacheck.yml index 32ded65..d9d6abf 100644 --- a/.github/workflows/luacheck.yml +++ b/.github/workflows/luacheck.yml @@ -18,4 +18,4 @@ jobs: - name: Setup ‘luacheck’ run: luarocks install luacheck - name: Run ‘luacheck’ linter - run: lua luacheck.lua . + run: cd util; lua luacheck.lua diff --git a/luacheck.lua b/util/luacheck.lua similarity index 94% rename from luacheck.lua rename to util/luacheck.lua index e86d4ba..141e18b 100755 --- a/luacheck.lua +++ b/util/luacheck.lua @@ -2,7 +2,7 @@ local exec = os.execute local fmt, find, sub = string.format, string.find, string.sub local var = "[%w%.%[%]\"\'_]" -exec("reset") +exec "clear" local function split(str, delim, include_empty, max_splits, sep_is_pattern) delim = delim or "," @@ -121,10 +121,10 @@ for _, p in ipairs(files) do _file:close() end - _load("./src/" .. p .. ".lua") + _load("../src/" .. p .. ".lua") end -exec("luacheck init.lua") -exec("luacheck ./src/operators.lua") -exec("luacheck ./src/*.l") -exec("rm ./src/*.l") +exec "luacheck ../init.lua" +exec "luacheck ../src/operators.lua" +exec "luacheck ../src/*.l" +exec "rm ../src/*.l" diff --git a/util/optipng.sh b/util/optipng.sh new file mode 100644 index 0000000..4e59b44 --- /dev/null +++ b/util/optipng.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Colors with 0 alpha need to be preserved, because opaque leaves ignore alpha. +# For that purpose, the use of indexed colors is disabled (-nc). + +cd ../textures +find -name '*.png' -print0 | xargs -0 optipng -o7 -zm1-9 -nc -strip all -clobber diff --git a/util/servers.lua b/util/servers.lua new file mode 100644 index 0000000..abd06a7 --- /dev/null +++ b/util/servers.lua @@ -0,0 +1,23 @@ +local JSON = require"JSON" -- luarocks install json-lua +os.execute "clear" + +local list = io.popen("curl -s -H 'Accept: text/html' http://servers.minetest.net/list"):read("*a") + list = JSON:decode(list).list + +local servers = {} + +for _, server in ipairs(list) do + if server.mods then + for _, mod in ipairs(server.mods) do + if mod == "i3" then + table.insert(servers, server.name) + end + end + end +end + +if #servers > 0 then + print(("=> %u/%u servers using [i3]:\n\t• %s"):format(#servers, #list, table.concat(servers, "\n\t• "))) +else + print"No server using [i3]" +end