Class DynamicVirtualNumberValue

An implementation of DynamicVirtualValue which stores a number.

Stack modes

  • Add: Returns lhs + rhs, default base value is 0
  • Mult: Returns lhs * rhs, default base value is 1

Usage

local dvnv = DynamicVirtualNumberValue.new("Add")
dvnv:newChild(1)
dvnv:newChild(2)
dvnv:newChild(3)
print(dvnv:get()) --> 0+1+2+3=6
local dvnv2 = DynamicVirtualNumberValue.new("Mult", 4)
dvnv2:newChild(5)
print(dvnv2:get()) --> 4*5=20
dvnv:addChild(dvnv2)
print(dvnv:get()) --> 0+1+2+3+(4*5)=26

See also:



generated by LDoc 1.4.6 Last updated 2021-01-21 07:22:00