sorcery  context.lua

File context.lua from the latest check-in


sorcery.ctx = {
	users = {};
	get = function(uo)
		local name = uo:get_player_name()
		if sorcery.ctx.users[name] == nil then
			sorcery.ctx.users[name] = {}
		end
		return sorcery.ctx.users[name]
	end;
	stat = function(uo)
		local name = uo:get_player_name()
		return (sorcery.ctx.users[name] ~= nil)
	end;
}

minetest.register_on_leaveplayer(function(obj)
	local name = obj:get_player_name()
	if sorcery.ctx.users[name] then
		sorcery.ctx.users[name] = nil
	end
end)