mirror of
https://github.com/wiremod/wire.git
synced 2025-03-04 03:03:04 -05:00
Fix luacheck issues in e2lib.lua
This commit is contained in:
parent
ac28f13a23
commit
00d6d18549
20
.luacheckrc
20
.luacheckrc
@ -1,14 +1,13 @@
|
||||
-- This file will be read by Luacheck <https://github.com/mpeterv/luacheck>.
|
||||
-- It's primarily to specify what globals are available across all files.
|
||||
|
||||
std = "luajit+garrysmod+wiremod"
|
||||
std = "luajit+garrysmod+wiremod+CPPI"
|
||||
|
||||
-- Problems to ignore
|
||||
ignore = {
|
||||
"212", -- Unused argument
|
||||
"4..", -- Redeclaration and shadowing
|
||||
"6..", -- All whitespace warnings (these are checked by git diff)
|
||||
"42.", -- Shadowing
|
||||
"43.", -- Upvalue shadowing
|
||||
}
|
||||
|
||||
files[".luacheckrc"].std = "min+luacheck"
|
||||
@ -3621,6 +3620,21 @@ stds.garrysmod.globals = {
|
||||
"SWEP",
|
||||
}
|
||||
|
||||
stds.CPPI = {
|
||||
read_globals = {
|
||||
CPPI = {
|
||||
fields = {
|
||||
CPPI_DEFER = {},
|
||||
CPPI_NOTIMPLEMENTED = {},
|
||||
GetName = {},
|
||||
GetVersion = {},
|
||||
GetInterfaceVersion = {},
|
||||
GetNameFromUID = {},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stds.wiremod = {}
|
||||
stds.wiremod.globals = {
|
||||
"BeamNetVars",
|
||||
|
@ -9,6 +9,7 @@ end
|
||||
|
||||
-- -------------------------- Helper functions -----------------------------
|
||||
local unpack = unpack
|
||||
local IsValid = IsValid
|
||||
|
||||
-- This functions should not be used in functions that tend to be used very often, as it is slower than getting the arguments manually.
|
||||
function E2Lib.getArguments(self, args)
|
||||
@ -186,7 +187,7 @@ end
|
||||
function E2Lib.isOwner(self, entity)
|
||||
if game.SinglePlayer() then return true end
|
||||
local player = self.player
|
||||
local owner = getOwner(self, entity)
|
||||
local owner = E2Lib.getOwner(self, entity)
|
||||
if not IsValid(owner) then return false end
|
||||
|
||||
return E2Lib.isFriend(owner, player)
|
||||
@ -254,31 +255,22 @@ end
|
||||
|
||||
-- ------------------------ list filtering -------------------------------------------------
|
||||
|
||||
local Debug = false
|
||||
local cPrint
|
||||
if Debug then
|
||||
if not console then require("console") end -- only needed if you want fancy-colored output.
|
||||
function cPrint(color, text) Msg(text) end
|
||||
|
||||
if console and console.Print then cPrint = console.Print end
|
||||
end
|
||||
|
||||
function E2Lib.filterList(list, criterion)
|
||||
local index = 1
|
||||
-- if Debug then print("-- filterList: "..#list.." entries --") end
|
||||
-- print("-- filterList: "..#list.." entries --")
|
||||
|
||||
while index <= #list do
|
||||
if not criterion(list[index]) then
|
||||
-- if Debug then cPrint(Color(128,128,128), "- "..tostring(list[index]).."\n") end
|
||||
-- MsgC(Color(128,128,128), "- "..tostring(list[index]).."\n")
|
||||
list[index] = list[#list]
|
||||
table.remove(list)
|
||||
else
|
||||
-- if Debug then print(string.format("+%3d %s", index, tostring(list[index]))) end
|
||||
-- print(string.format("+%3d %s", index, tostring(list[index])))
|
||||
index = index + 1
|
||||
end
|
||||
end
|
||||
|
||||
-- if Debug then print("--------") end
|
||||
-- print("--------")
|
||||
return list
|
||||
end
|
||||
|
||||
@ -338,7 +330,6 @@ E2Lib.optable_inv = {
|
||||
dlt = "$",
|
||||
trg = "~",
|
||||
imp = "->",
|
||||
fea = "foreach",
|
||||
}
|
||||
|
||||
E2Lib.optable = {}
|
||||
@ -437,9 +428,7 @@ end
|
||||
do
|
||||
-- Shared stuff, defined later.
|
||||
|
||||
local extensions = nil
|
||||
local function printExtensions() end
|
||||
local function conCommandSetExtensionStatus() end
|
||||
local extensions, printExtensions, conCommandSetExtensionStatus
|
||||
|
||||
function E2Lib.GetExtensions()
|
||||
return extensions.list
|
||||
|
Loading…
Reference in New Issue
Block a user