A flavorful alternative to ValueBase objects in the Roblox engine, with intelligent replication
VirtualValue is a library of classes which contain, manipulate and replicate data, much like what a ValueBase object does. The titular class, VirtualValue ("VV" for short), stores a single value of one type. You can get, set, and listen for changes to this value. You can replicate using a Server to select players.
The subclass DynamicVirtualValue ("DVV" for short) allows adding multiple VirtualValue to it as children. The DVV specifies a "stacking" operation which combines its value and the values of its children into a single value (for example, DynamicVirtualNumberValue can use additive stacking). This result is calculated on-retrieval (lazily), and the result is cached. Additionally, unlike ValueBase objects, a VirtualValue may be a child of more than one DynamicVirtualValue, allowing its value to be composed in multiple places.
Included are several implementations of VirtualValue and DynamicVirtualValue which handle numbers, strings and booleans.
The boilerplate place includes VirtualValue and its primary dependency, (Modules), already installed in a blank place. Download it, then try out an example!
Built from in-code doc comments using LDoc. You can install it with LuaRocks.
With GNU make, you can build VirtualValue using Rojo 6.
# Build VirtualValue.rbxmx $ make # Build VirtualValue-test.rbxlx $ make test # Build VirtualValue-boilerplate.rbxlx $ make boilerplate
Tests are run by opening
VirtualValue-test.rbxlx and clicking "Play" in-Studio. To test replication related features, a Player is required.