Simply put, stuff like gl.GetSun (which calls Spring variables that have already been set via the map) should be available to synced, as read-only variables. I.E., store them somewhere where synced Lua can fetch them safely.
Why? Because otherwise operations that require these values fail, which can bring down the entire Lua state.
I've been getting around this problem by sending a message via LuaUI, but I've had to write some pretty big chunks of safety code to handle situations like reloading the LuaRules states because this information isn't available any other way.
Make certain GL state variables available to Sync
Moderator: Moderators
Re: Make certain GL state variables available to Sync
It's prone to desync, in particular if something like this is implemented.
Why not send the value to synced part of gadget from the unsynced part of the same gadget?
Also why big chunks safety code if all the safety code you need is properly initialising your (global) variable that holds whatever gl.GetSun returns to some neutral value?
Why not send the value to synced part of gadget from the unsynced part of the same gadget?
Also why big chunks safety code if all the safety code you need is properly initialising your (global) variable that holds whatever gl.GetSun returns to some neutral value?
Re: Make certain GL state variables available to Sync
I am; actually, I use a Widget to send it to every Gadget that needs that data, simultaneously. However, if LuaRules gets reset, the data's not being sent again, and apparently isn't in memory, either. I wrote a kludge fix for it, but it's a chicken-and-egg problem- I need that data during Initialize(), not later.Why not send the value to synced part of gadget from the unsynced part of the same gadget?
Re: Make certain GL state variables available to Sync
So not from LuaUITobi wrote:Why not send the value to synced part of gadget from the unsynced part of the same gadget?

Re: Make certain GL state variables available to Sync
Won't that run after the synced part initializes? If not, great, that provides a workaround 

Re: Make certain GL state variables available to Sync
Yes, unsynced part of gadgets is initialized after synced part.
That is exactly what you want cause then you can be sure synced part is there already to receive the message unsynced part sent when it got initialised. Before that time use the safe/neutral default value in the synced part.
That is exactly what you want cause then you can be sure synced part is there already to receive the message unsynced part sent when it got initialised. Before that time use the safe/neutral default value in the synced part.