Bing Chat AI is amazing for helping with defold programming

BTW: ChatGPT wrote this for me to track attributes for objects created in my game. Works perfectly and cleaner than I could do.

local M = {}

local objects = {}

function M.create_object(name, initialAttributes)
	objects[name] = initialAttributes or {}
end

function M.set_attribute(name, key, value)
	if objects[name] then
		objects[name][key] = value
	end
end

function M.get_attribute(name, key)
	if objects[name] then
		return objects[name][key]
	end
end

function M.add_increment_attribute(name, key, value)
	if objects[name] and objects[name][key] then
		objects[name][key] = objects[name][key] + value
	end
end

function M.percent_increment_attribute(name, key, percent)
	if objects[name] and objects[name][key] then
		objects[name][key] = objects[name][key] * percent
	end
end

return M