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.
|
||||
|
||||
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 res = {}
|
||||
|
||||
@ -26,7 +14,7 @@ local function v_mult_fold(identity)
|
||||
return function(elems)
|
||||
local tot = identity
|
||||
|
||||
for k, v in pairs(elems) do
|
||||
for _, v in pairs(elems) do
|
||||
tot = v_mult(tot, v)
|
||||
end
|
||||
|
||||
@ -42,7 +30,7 @@ player_monoids.speed = monoid({
|
||||
combine = function(x, y) return x * y end,
|
||||
fold = function(elems)
|
||||
local res = 1
|
||||
for k, v in pairs(elems) do
|
||||
for _, v in pairs(elems) do
|
||||
res = res * v
|
||||
end
|
||||
|
||||
@ -63,7 +51,7 @@ player_monoids.jump = monoid({
|
||||
combine = function(x, y) return x * y end,
|
||||
fold = function(elems)
|
||||
local res = 1
|
||||
for k, v in pairs(elems) do
|
||||
for _, v in pairs(elems) do
|
||||
res = res * v
|
||||
end
|
||||
|
||||
@ -83,7 +71,7 @@ player_monoids.gravity = monoid({
|
||||
combine = function(x, y) return x * y end,
|
||||
fold = function(elems)
|
||||
local res = 1
|
||||
for k, v in pairs(elems) do
|
||||
for _, v in pairs(elems) do
|
||||
res = res * v
|
||||
end
|
||||
|
||||
@ -103,7 +91,7 @@ player_monoids.gravity = monoid({
|
||||
player_monoids.fly = monoid({
|
||||
combine = function(p, q) return p or q end,
|
||||
fold = function(elems)
|
||||
for k, v in pairs(elems) do
|
||||
for _, v in pairs(elems) do
|
||||
if v then return true end
|
||||
end
|
||||
|
||||
@ -130,7 +118,7 @@ player_monoids.fly = monoid({
|
||||
player_monoids.noclip = monoid({
|
||||
combine = function(p, q) return p or q end,
|
||||
fold = function(elems)
|
||||
for k, v in pairs(elems) do
|
||||
for _, v in pairs(elems) do
|
||||
if v then return true end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user