Add util/
This commit is contained in:
parent
2fa971acb4
commit
5e8ecf9903
|
@ -18,4 +18,4 @@ jobs:
|
||||||
- name: Setup ‘luacheck’
|
- name: Setup ‘luacheck’
|
||||||
run: luarocks install luacheck
|
run: luarocks install luacheck
|
||||||
- name: Run ‘luacheck’ linter
|
- name: Run ‘luacheck’ linter
|
||||||
run: lua luacheck.lua .
|
run: cd util; lua luacheck.lua
|
||||||
|
|
|
@ -2,7 +2,7 @@ local exec = os.execute
|
||||||
local fmt, find, sub = string.format, string.find, string.sub
|
local fmt, find, sub = string.format, string.find, string.sub
|
||||||
local var = "[%w%.%[%]\"\'_]"
|
local var = "[%w%.%[%]\"\'_]"
|
||||||
|
|
||||||
exec("reset")
|
exec "clear"
|
||||||
|
|
||||||
local function split(str, delim, include_empty, max_splits, sep_is_pattern)
|
local function split(str, delim, include_empty, max_splits, sep_is_pattern)
|
||||||
delim = delim or ","
|
delim = delim or ","
|
||||||
|
@ -121,10 +121,10 @@ for _, p in ipairs(files) do
|
||||||
_file:close()
|
_file:close()
|
||||||
end
|
end
|
||||||
|
|
||||||
_load("./src/" .. p .. ".lua")
|
_load("../src/" .. p .. ".lua")
|
||||||
end
|
end
|
||||||
|
|
||||||
exec("luacheck init.lua")
|
exec "luacheck ../init.lua"
|
||||||
exec("luacheck ./src/operators.lua")
|
exec "luacheck ../src/operators.lua"
|
||||||
exec("luacheck ./src/*.l")
|
exec "luacheck ../src/*.l"
|
||||||
exec("rm ./src/*.l")
|
exec "rm ../src/*.l"
|
|
@ -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
|
|
@ -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
|
Ŝarĝante…
Reference in New Issue