----- Controller Table -----


local ReplicaController = {

	NewReplicaSignal = Madwork.NewScriptSignal(), -- (Replica)
	InitialDataReceivedSignal = Madwork.NewScriptSignal(), -- ()
	InitialDataReceived = false,

	_replicas = {
		--[[
			[replica_id] = {
				Data = {}, -- [table] Replicated Replica data table
				Id = 1, -- [integer] Replica id
				Class = "", -- [string] Primary Replica identifier
				Tags = {UserId = 2312310}, -- [table] Secondary Replica identifiers
				
				Parent = Replica, -- [Replica / nil] -- Child replicas inherit replication settings
				Children = {}, -- [table] {replica, ...}
						
				_write_lib = {[func_id] = function, ...} / nil, -- [table] List of wrapped write functions
				_write_lib_dictionary = {["function_name"] = func_id, ...} / nil, -- [table] Dictionary of function names and their id's
				
				_table_listeners = {[1] = {}} -- [table] Listeners of specific value changes in replica data
				_function_listeners = {[func_id] = {listener, ...}, ...} -- [table] Listeners of write function calls
				_raw_listeners = {listener, ...},
				
				_signal_listeners = {},
				_maid = maid,
			}
		--]]
	},

	_class_listeners = {}, -- {["replica_class"] = script_signal, ...}
	_child_listeners = {}, -- {[replica_id] = {listener, ...}, ...}

}
