Skip to content

Reactive & Watch Done

Latest
Compare
Choose a tag to compare
@kurapica kurapica released this 12 May 09:41
· 11 commits to master since this release

A new reactive & watch system is added to simple the usages of the reactivex.

require "PLoop" (function(_ENV)
    switcher = reactive(false)
    data = reactive{
        on = "Go",
        off = "Stop"
    }

    info = reactive{
        label = watch(function(_ENV) return switcher and data.on or data.off end)
    }

    watch(function(_ENV) print("Info is " .. info.label) end) -- Info is Stop

    switcher.Value = true -- Info is Go
    data.on = "Continue"  -- Info is Continue
end)