Is there a way to have server-side variables in Space Lua? I am modifying the Git library and one issue I wanted to avoid was race conditions if the same instance is being browsed in multiple tabs, browsers and devices. The only way I can think of to do this is a mutex implemented using server-side state, but I am unable to figure out how to do this.
(BTW, my current modification to Git.md is here, in case it’s useful to someone: git.md · GitHub)
File-based locking isn’t reliable and therefore not safe.
, but ultimately it amounts to the same thing: files are sh*t for this.
I guess your best bet is doing everything on the server, inside a bash script for example, but this is far from perfect.
A mutex api would probably make sense although I don’t think that’s trivial to implement, there are definitely some things to consider.