Synced --> UnSynced Mess... help plz - Page 2

Synced --> UnSynced Mess... help plz

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

Moderator: Moderators

User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Synced --> UnSynced Mess... help plz

Post by Argh »

What the hell's a deep copy, and how do I do it?

I'm doing:

local particleCopy
particleCopy = particleList

...before I bind the first FBO and begin iterating within it's function.

Do I need to do a full iteration, i.e.:

Code: Select all

for i = 1,#particleList,1 do
particleCopy[i] = particleList[i]???
end
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Synced --> UnSynced Mess... help plz

Post by Argh »

So I wrote this:

Code: Select all

local particleCopy = {}

for i = 1,#particleList,1 do
particleCopy[i] = particleList[i]
	for j,k in ipairs (particleList[i]) do

		particleCopy[i][j] = k
	end
end
Deep copy, right?

Well, it still failed. WTF!!! WHY IS MY DATA GETTING WRITTEN TO WHILE THE DRAWGENESIS FUNCTION HASN'T RETURNED YET....
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Synced --> UnSynced Mess... help plz

Post by aegis »

that's not a very deep copy.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Synced --> UnSynced Mess... help plz

Post by Argh »

I FIXED IT.

You guys are never going to believe this.

Moving the entire particle-update function to DrawWorld() fixed it. Completely. Even after I moved the iteration functions back inside the FBOs. I'll leave it to somebody to figure out why; I've been fighting with this for two days, and it was the last remaining problem with P.O.P.S. + a working texture atlas.

OK, now to get back to doing something useful...
Post Reply

Return to “Lua Scripts”