[API] How to properly invaidate variables?
LubieKakao1212 opened this issue · 6 comments
Issue type:
- ❓ Question
Question:
I was trying to make a OpenComputers compatibility addon, and encountered a problem with updating variable values.
When I was testing and used variable card directly referencing my value it updated corectly, but when I used a variable referencing that variable card it updated its value only when I reinserting the card.
Is calling invalidate on a variable not enough?
@LubieKakao1212 It looks like your re-creating the variable after invalidation.
Instead, you probably want to reuse the same variable, but call invalidate()
if its value has changed.
I recommend having a look at the source code of Integrated REST: https://github.com/CyclopsMC/IntegratedREST/
It feels very similar to what you are trying to achieve.
Expose Integrated Dynamics networks as a REST API. Contribute to CyclopsMC/IntegratedREST development by creating an account on GitHub.
@rubensworks
Thanks, It almost works now.
Someone will answer your question soon. In the meantime, you might be able to get help more quickly on our Discord server.
@LubieKakao1212 Could you share your code? It's a bit difficult to understand what could be going on.
In any case, the variables created from proxies should be a good basis to start from in your case.