This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Lua variables visibility and events management
#2
You're correct about how variables work. But each script is a separate OS process. You cannot share variables between processes directly. For this you can use storage.
The construct is mostly meant for resident scripts but it will work in a event script even though it's not necessary.
If you want to implement a counter that can be reset then the increment must be an atomic operation. Use this to increment a storage value by 1:
Code:
storage.exec('incr', 'my_key_name')
Reply


Messages In This Thread
RE: Lua variables visibility and events management - by admin - 18.11.2020, 14:37

Forum Jump: