123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- ---
- --- Generated by EmmyLua(https://github.com/EmmyLua)
- --- Created by PZM.
- --- DateTime: 2021/9/10 9:23
- ---
- require "Util/Dot2"
- require "Util/Misc"
- require "Util/TimerFunc"
- require "Util/MaterialUtil"
- require "Util/ColorUtil"
- require "Util/DebugFlagUtil"
- require "Util/ValueTypePool"
- require "Util/CronosUtil"
- ---@class Util
- Util = class()
- local this = Util
- function IsSubTypeOf(c,base)
- if c == base then
- return true
- end
- if c.__bases then
- for _, _base in ipairs(c.__bases) do
- if _base == base then
- return true
- end
- end
- end
- local b = getmetatable(c)
- if not b then
- return false
- end
- if b == base then
- return true
- end
- return IsSubTypeOf(b,base)
- end
- function IsSubTypeOfTryCatch(c,base,isTryCatchLog)
- local isSubType = false
- try
- {
- main = function()
- isSubType = IsSubTypeOf(c,base)
- end,
- catch = function(errors)
- isSubType = false
- if isTryCatchLog then
- logError(errors)
- end
- end
- }
- return isSubType
- end
- ---@param pool TablePool
- function DeepCopy(t,pool)
- --local InTable = {};
- local function Func(t)
- if type(t) ~= "table" then
- return t;
- end
- local NewTable =pool and pool:Pop() or {}
- --InTable[t] = NewTable
- for k,v in pairs(t) do
- NewTable[Func(k)] = Func(v)
- end
- return setmetatable(NewTable, getmetatable(t))
- end
- return Func(t)
- end
- function TableContainsKey(tbl, key)
- for k,v in pairs(tbl) do
- if k ==key then
- return true
- end
- end
- return false
- end
|