math.random sync?

math.random sync?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

math.random sync?

Post by Anarchid »

I have a Suspicion. So, can anyone tell me whether math.random will sync when invoked within a gadget's synced context? :P
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: math.random sync?

Post by Kloot »

Yes.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: math.random sync?

Post by lurker »

You have to go out of your way to desync.

Code: Select all

local desyncedstring = ''
for i=1,5 do
  local t = {} for i = 10,99 do t[{}]=i end
  local _,digits = next(t)
  desyncedstring = desyncedstring .. digits
end
Post Reply

Return to “Lua Scripts”