mirror of
https://github.com/minetest-mods/player_monoids.git
synced 2025-01-10 01:20:20 +01:00
Add .luacheckrc
and fix warnings.
This commit is contained in:
parent
481ef9e2cd
commit
5d90e32196
9
.luacheckrc
Normal file
9
.luacheckrc
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
read_globals = {
|
||||||
|
"minetest",
|
||||||
|
"vector",
|
||||||
|
}
|
||||||
|
|
||||||
|
globals = {
|
||||||
|
"player_monoids",
|
||||||
|
}
|
@ -1,17 +1,5 @@
|
|||||||
-- Standard effect monoids, to provide canonicity.
|
-- Standard effect monoids, to provide canonicity.
|
||||||
|
|
||||||
local function mult(x, y) return x * y end
|
|
||||||
|
|
||||||
local function mult_fold(elems)
|
|
||||||
local tot = 1
|
|
||||||
|
|
||||||
for k,v in pairs(elems) do
|
|
||||||
tot = tot * v
|
|
||||||
end
|
|
||||||
|
|
||||||
return tot
|
|
||||||
end
|
|
||||||
|
|
||||||
local function v_mult(v1, v2)
|
local function v_mult(v1, v2)
|
||||||
local res = {}
|
local res = {}
|
||||||
|
|
||||||
@ -26,7 +14,7 @@ local function v_mult_fold(identity)
|
|||||||
return function(elems)
|
return function(elems)
|
||||||
local tot = identity
|
local tot = identity
|
||||||
|
|
||||||
for k, v in pairs(elems) do
|
for _, v in pairs(elems) do
|
||||||
tot = v_mult(tot, v)
|
tot = v_mult(tot, v)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -42,7 +30,7 @@ player_monoids.speed = monoid({
|
|||||||
combine = function(x, y) return x * y end,
|
combine = function(x, y) return x * y end,
|
||||||
fold = function(elems)
|
fold = function(elems)
|
||||||
local res = 1
|
local res = 1
|
||||||
for k, v in pairs(elems) do
|
for _, v in pairs(elems) do
|
||||||
res = res * v
|
res = res * v
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -63,7 +51,7 @@ player_monoids.jump = monoid({
|
|||||||
combine = function(x, y) return x * y end,
|
combine = function(x, y) return x * y end,
|
||||||
fold = function(elems)
|
fold = function(elems)
|
||||||
local res = 1
|
local res = 1
|
||||||
for k, v in pairs(elems) do
|
for _, v in pairs(elems) do
|
||||||
res = res * v
|
res = res * v
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -83,7 +71,7 @@ player_monoids.gravity = monoid({
|
|||||||
combine = function(x, y) return x * y end,
|
combine = function(x, y) return x * y end,
|
||||||
fold = function(elems)
|
fold = function(elems)
|
||||||
local res = 1
|
local res = 1
|
||||||
for k, v in pairs(elems) do
|
for _, v in pairs(elems) do
|
||||||
res = res * v
|
res = res * v
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -103,7 +91,7 @@ player_monoids.gravity = monoid({
|
|||||||
player_monoids.fly = monoid({
|
player_monoids.fly = monoid({
|
||||||
combine = function(p, q) return p or q end,
|
combine = function(p, q) return p or q end,
|
||||||
fold = function(elems)
|
fold = function(elems)
|
||||||
for k, v in pairs(elems) do
|
for _, v in pairs(elems) do
|
||||||
if v then return true end
|
if v then return true end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -130,7 +118,7 @@ player_monoids.fly = monoid({
|
|||||||
player_monoids.noclip = monoid({
|
player_monoids.noclip = monoid({
|
||||||
combine = function(p, q) return p or q end,
|
combine = function(p, q) return p or q end,
|
||||||
fold = function(elems)
|
fold = function(elems)
|
||||||
for k, v in pairs(elems) do
|
for _, v in pairs(elems) do
|
||||||
if v then return true end
|
if v then return true end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user