Page 2 of 2

Re: Initializing a specific object with arbitrary parameters

Posted: Thu Sep 25, 2008 1:21 pm
by Kaze
Mr. Strange wrote:

Code: Select all

function ApplyParams(id, p)
	for i,v in pairs(p) do
			minion[i] = v
		end
	end
end
Perhaps you meant to do this?

Code: Select all

function ApplyParams(id, p)
	for i,v in pairs(p) do
			minion[id][i] = v
		end
	end
end

Re: Initializing a specific object with arbitrary parameters

Posted: Thu Sep 25, 2008 6:52 pm
by Mr. Strange
rude wrote:
Mr. Strange wrote:I suppose that maybe this is to be expected
No it's not. Precisely how does it "blow up"?
Well, apparently the real lesson is that at 5 in the morning I should just go to sleep - I was able to get everything working find this morning.

I'm really not sure what the problem was I was having - everything is dandy now. I was doing some cleanup, so I probably corrected some tiny typo somewhere which corrected things.

----------------------------------------------
Kaze wrote: Perhaps you meant to do this?

Code: Select all

function ApplyParams(id, p)
	for i,v in pairs(p) do
			minion[id][i] = v
		end
	end
end
Yes exactly. I'm simplifying my example some when I post them here, but you're correct - I am using "id" to specify the index in my general object list. Good catch.

--Mr. Strange