Do some code linting with luacheck

This commit is contained in:
Montandalar 2021-02-11 02:23:21 +11:00
parent be8a39eae0
commit 20019a3d3e
2 changed files with 23 additions and 9 deletions

16
.luacheckrc Normal file
View File

@ -0,0 +1,16 @@
read_globals = {
"DIR_DELIM",
"core",
"dump",
"vector", "nodeupdate",
"VoxelManip", "VoxelArea",
"PseudoRandom", "ItemStack",
"AreaStore",
"default",
table = { fields = { "copy", "getn" } }
}
globals = {
"minetest"
}

View File

@ -95,7 +95,7 @@ local warp = function(player, dest)
minetest.sound_play("warps_plop", {pos = pos}) minetest.sound_play("warps_plop", {pos = pos})
end end
do_warp_queue = function() local function do_warp_queue()
if table.getn(warps_queue) == 0 then if table.getn(warps_queue) == 0 then
queue_state = 0 queue_state = 0
return return
@ -262,12 +262,11 @@ local function prepare_formspec(dest)
else else
custdest = "" custdest = ""
end end
s_formspec = "size[4.5,3]label[0.7,0;Warp destination]" return "size[4.5,3]label[0.7,0;Warp destination]"
s_formspec = s_formspec .. "field[1,2.2;3,0.2;destination;Future destination;" .."field[1,2.2;3,0.2;destination;Future destination;"
..minetest.formspec_escape(custdest).."]" ..minetest.formspec_escape(custdest).."]"
.."button_exit[0.7,2.7;3,0.5;proceed;Proceed]" .."button_exit[0.7,2.7;3,0.5;proceed;Proceed]"
..prepare_dropdown(0.7,0.4,3,1, dest) ..prepare_dropdown(0.7,0.4,3,1, dest)
return s_formspec
end end
minetest.register_node("warps:warpstone", { minetest.register_node("warps:warpstone", {
@ -308,7 +307,6 @@ minetest.register_node("warps:warpstone", {
end end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local s_formspec, formspec_help
meta:set_string("formspec", prepare_formspec(dest)) meta:set_string("formspec", prepare_formspec(dest))
meta:set_string("infotext", "Warp stone to " .. dest) meta:set_string("infotext", "Warp stone to " .. dest)
@ -332,7 +330,7 @@ minetest.register_node("warps:warpstone", {
return false return false
end end
minetest.log("action", string.format("Going to warp player %s to waypoint %s", minetest.log("action", string.format("Going to warp player %s to waypoint %s",
puncher:get_player_name(), minetest.formspec_escape(destination) puncher:get_player_name(), destination
)) ))
warp_queue_add(puncher, destination) warp_queue_add(puncher, destination)
end, end,