detectGlobalWrites
Definition
-- @/lua/common/utils.lua:1304
-- function testSerialization()
-- d = {a = "foo", b = {c = 123, d = "foo", p = vec3(1,2,3)}}
-- print("original data: " .. tostring(d))
-- dump(d)
-- s = serialize(d)
-- print("serialized data: " .. tostring(s))
-- da = deserialize(s)
-- print("restored data: " .. tostring(da))
-- dump(da)
-- sa = serialize(da)
-- if sa == s then
-- print "serialization seems to work"
-- else
-- print "serialization got problems, look above"
-- end
-- if deserialize(serialize(nil)) ~= nil then print "serialize with nil fails to work corectly" end
-- end
--testSerialization()
--MARK: Other
function detectGlobalWrites()
setmetatable(_G, {
__newindex = function (t, key, val)
rawset(_G, key, val)
log('W', 'globals', debug.traceback('set new global variable: "' .. tostring(key) .. '" to "' .. tostring(val) .. '"', 2, 1, false))
end,
})
end
Callers
@/lua/vehicle/main.lua
-- be sensitive about global writes from now on
detectGlobalWrites()
updateCorePhysicsStepEnabled()
@/lua/ge/main.lua
-- be sensitive about global writes from now on
detectGlobalWrites()