generated from sage/tiny-ecs-love-template
42 lines
1.2 KiB
Lua
42 lines
1.2 KiB
Lua
tinyTrackEntityAges = false
|
|
tinyLogSystemUpdateTime = false
|
|
tinyLogSystemChanges = false
|
|
tinyWarnWhenNonDataOnEntities = false
|
|
|
|
getCurrentTimeMilliseconds = function()
|
|
return love.timer.getTime() * 1000
|
|
end
|
|
|
|
ENTITY_INIT_MS = { "ENTITY_INIT_MS" }
|
|
if tinyTrackEntityAges then
|
|
function tinyGetEntityAgeMs(entity)
|
|
return entity[ENTITY_INIT_MS]
|
|
end
|
|
end
|
|
|
|
if tinyWarnWhenNonDataOnEntities then
|
|
function checkForNonData(e, nested, tableCache)
|
|
nested = nested or false
|
|
tableCache = tableCache or {}
|
|
|
|
local valType = type(e)
|
|
if valType == "table" then
|
|
if tableCache[e] then
|
|
return
|
|
end
|
|
tableCache[e] = true
|
|
for k, v in pairs(e) do
|
|
local keyWarning = checkForNonData(k, true, tableCache)
|
|
if keyWarning then
|
|
return keyWarning
|
|
end
|
|
local valueWarning = checkForNonData(v, true, tableCache)
|
|
if valueWarning then
|
|
return valueWarning
|
|
end
|
|
end
|
|
elseif valType == "function" or valType == "thread" or valType == "userdata" then
|
|
return valType
|
|
end
|
|
end
|
|
end |