Skip to content

Commit

Permalink
移除部分debug日志
Browse files Browse the repository at this point in the history
完善注释
  • Loading branch information
Muscipular committed Sep 26, 2021
1 parent e7b31fe commit f2b432f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
12 changes: 12 additions & 0 deletions libs/GlobalEvents.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ end

local eventCallbacks = {}
local ix = 0;

--- 注册全局事件
---@param eventName string
---@param fn function
---@param moduleName string
---@param extraSign string|nil
---@return number 全局注册Index
function _G.regGlobalEvent(eventName, fn, moduleName, extraSign)
extraSign = extraSign or ''
logInfo('GlobalEvent', 'regGlobalEvent', eventName, moduleName, ix + 1, eventCallbacks[eventName .. extraSign])
Expand Down Expand Up @@ -111,6 +118,11 @@ function _G.regGlobalEvent(eventName, fn, moduleName, extraSign)
return ix;
end

--- 移除全局事件
---@param eventName string
---@param fnIndex number 全局注册Index
---@param moduleName string
---@param extraSign string|nil
function _G.removeGlobalEvent(eventName, fnIndex, moduleName, extraSign)
extraSign = extraSign or ''
logInfo('GlobalEvent', 'removeGlobalEvent', eventName .. extraSign, moduleName, fnIndex)
Expand Down
10 changes: 9 additions & 1 deletion libs/ModuleBase.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---@class ModuleBase
---@field name string
---@field lastIx number
---@field parts table[]
---@field parts ModulePart[]
---@field migrations {version:number,name:string,value:string|function}[]|nil
---@field callbacks {fnCb: function, fnIndex: number, key: string}[]
local ModuleBase = { name = '', callbacks = {}, lastIx = 0, migrations = nil };
Expand Down Expand Up @@ -62,6 +62,14 @@ function ModuleBase:createModule(name, depParts)
return SubModule;
end

---@class ModulePart
---@field name string
---@field onLoad function
---@field onUnload function
---@field ___isPart boolean

---@param name string
---@return ModulePart
function ModuleBase:createPart(name)
local SubModule = {
name = name,
Expand Down
1 change: 1 addition & 0 deletions libs/ModuleSystem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ end
---@field simpleModule boolean 是否兼容老的luaModule
---@field absolutePath boolean

---解决兼容普通lua的问题
local function forSimpleModule()
local callInCtx;
local function loadFile(file, cb)
Expand Down
7 changes: 6 additions & 1 deletion libs/sql.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
_G.SQL = _G.SQL or {}
local SQL = _G.SQL;

function SQL.sqlValue(s)
if s == nil then
return 'null'
Expand All @@ -22,7 +23,8 @@ function SQL.sqlValue(s)
end
return 'null';
end
function SQL.querySQL(sql)

function SQL.querySQL(sql, returnNil)
local result = SQL.Run(sql)
if type(result) == "table" then
local res = {}
Expand All @@ -36,6 +38,9 @@ function SQL.querySQL(sql)
end
return res
end
if result == SQL.CONST_RET_NO_ROW and returnNil then
return nil;
end
return result
end
SQL.CONST_RET_NO_ROW = -3;

0 comments on commit f2b432f

Please sign in to comment.