Can we have a feature where Calling OnSet() will be called immediately on the first time?
I have been writing it like this for the past few days. (Using Fusion for UI)
where I have to set the variable first, and connect on a onSet function
to capture changes.
Instead if we can have where OnSet() will be called immediately if it detects it existed already for the first time. So we can easily write it like this instead
However that doesn’t really erase the fact that Luau is not as good as languages that are the industry standard…
luau is a very up to date and fast language and could very much be used widespread in the industry. its a good example of how to do a high level lang right.
want something even faster and still lua? luajit (one of the fastest languages btw)
speaks plenty about your incapacity to show understanding. And instead push forth your own agenda and defensive measures against your ‘victim’.
you’re gonna say this after admitting yourself your entire first statement was just pure glaze, you’re just filling the devforum with more meaningless bs
Replica allows you to call .OnNew() whenever you like. Also Replicas are passed by reference to .OnNew() listeners, so several .OnNew() listeners could receive the same reference to a single replica.
My personal idea behind implementing Replica is to instantiate objects whenever a new replica is received through .OnNew() and push any externally relevant changes of a Replica to signals (e.g. Object.HealthChanged) defined by the developer using a custom signal class.
As for your question about replica:OnChange() I don’t have any tips for you. :OnChange() simply provides all relevant data that was used to mutate any value in a replica.
I’m really enjoying Replica! Let us know if this ever gets published to wally please. I think someone already did it but I do not trust re-publishes not from the original creator (especially if I want to always have the most up-to-date version of the module).
Hello @loleris I’ve ran into an issue with Replica, client replica does not detect when a new entry is added while using OnSet(), is this intentional? Are we supposed to use :OnChange if we want to listen to new keys?
:OnSet() listens to a change for the specified path (path in :OnSet() and :Set() have to match) - it was not meant to detect changes to a list - at that point using OnChange is the solution.
This is an extremely powerful module for server-sided data that isn’t able to be easily replicated (profiles, large tables of data with pets, items, etc.) as well as global data that you want to keep in memory for performance (without instancing).
If you just want to show player cash, this isn’t for you. However, if you want to create an inventory system, and a cash display, kills display, just anything that requires a lot of different fields of data, this is 100% for you and is an amazing resource.