{"id":"thehehfocus/replicador","name":"replicador","scope":"thehehfocus","platform":"roblox","description":"Simple library for structure replication.","version":"0.1.37","latest":"0.1.37","versions":["0.1.1","0.1.2","0.1.3","0.1.5","0.1.6","0.1.7","0.1.8","0.1.9","0.1.10","0.1.11","0.1.12","0.1.13","0.1.14","0.1.20","0.1.21","0.1.22","0.1.23","0.1.24","0.1.25","0.1.26","0.1.27","0.1.28","0.1.29","0.1.30","0.1.31","0.1.32","0.1.34","0.1.35","0.1.36","0.1.37"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"37dd445d62ad66c5e03c6efa955546e2fbe66f0b72d0fa78c617917a2401c796","likes":0,"downloads":0,"install":"forest install thehehfocus/replicador","url":"https://forest.dev/p/roblox/thehehfocus/replicador","files":"https://api.forest.dev/ai/package/roblox/thehehfocus/replicador/files","readme":"# Replicador\r\nSimple to use library for server authoritative to reactive-client replication.\r\n\r\nModule constructs auto replication, types and methods on paths of any depth.\r\n\r\nHas proper tag/identifier management, replication settings.\r\n\r\nWally link: [here](https://wally.run/package/thehehfocus/replicador) <br>\r\n\r\n## Example use\r\n- (using special singleton function, ensures there's only one object target, handles wait for player loading, deepcopies datatemplate)\r\n\r\nServer:\r\n```luau\r\n--!strict\r\nlocal Replicador = require(game.ReplicatedStorage.Replicador)\r\nReplicador.Singleton.init() -- single init function for client/server\r\n\r\nlocal Data = { -- Define data type, anything replicatable\r\n\tEquippedSlot = nil :: number?,\r\n\tSlots = {} :: {{Name: string}},\r\n\tEquipment = {\r\n\t\tHead = nil :: string?,\r\n\t\tBody = nil :: string?,\r\n\t\tLegs = nil :: string?\r\n\t},\r\n}\r\n\r\nlocal Object = Replicador.Singleton.new(\"Test\", Data, Player) -- Player argument - overload and get ServerClass.\r\n\r\n-- Simple set!\r\n-- +Intellisense.\r\nObject.Data.EquippedSlot:Set(1)\r\nObject.Data.Equipment.Head:Set(\"Helmet\")\r\nObject.Data.Slots:Insert({Name = \"Potion\"}, 1)\r\n\r\ntask.wait(3)\r\n\r\nObject.Data.Slots[1]:Set({\r\n\tName = \"PotionOverride\"\r\n})\r\nprint(Object.Data.Slots:Get())\r\n```\r\n\r\nClient:\r\n```luau\r\nlocal Replicador = require(game.ReplicatedStorage.Replicador)\r\nReplicador.Singleton.init()\r\n\r\nlocal Data = { -- Define data type\r\n\tEquippedSlot = nil :: number?,\r\n\tSlots = {} :: {{Name: string}},\r\n\tEquipment = {\r\n\t\tHead = nil :: string?,\r\n\t\tBody = nil :: string?,\r\n\t\tLegs = nil :: string?\r\n\t},\r\n}\r\n\r\nlocal Object = Replicador.Singleton.new(\"Test\", Data) -- ClientClass with DataTemplate\r\n\r\nObject.SignalChanged:Connect(function(Path, Value, Action) -- Runs on any Data action.\r\n\tprint(`Made a change at path: {Path}, with action: {Action}, and value: {Value}`)\r\nend)\r\n\r\nObject.Data.Equipment:OnKeyChange(function(Key, Value, OldValue) -- Runs when child of the table changes value.\r\n\tprint(`Equipment {Key} changed from {OldValue} to {Value}`)\r\nend)\r\n\r\nObject.Data.Equipment.Head:OnChange(function(Value, OldValue) -- Runs when value at the path changes.\r\n\tprint(`Set head equipment from {OldValue} to {Value}`)\r\nend)\r\n\r\nObject.Data.Slots:OnInsert(function(Value, Index) -- Runs whenever an insertion method is called on the table.\r\n\tprint(`Inserted a slot {Value} at {Index}`)\r\nend)\r\n\r\nlocal Name = Object.Data.Slots[1].Name -- We can cache the path proxies, even if they dont have a value yet. \r\nName:OnChange(function(Value, OldValue)\r\n\tprint(`First slot's name changed from {OldValue}, to {Value}`)\r\nend)\r\n```\r\n","readmeTruncated":false}