Initializing a specific object with arbitrary parameters

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
Kaze
Party member
Posts: 189
Joined: Sat Jul 19, 2008 4:39 pm
Location: Dublin, Ireland

Re: Initializing a specific object with arbitrary parameters

Post 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
Mr. Strange
Party member
Posts: 101
Joined: Mon Aug 11, 2008 5:19 am

Re: Initializing a specific object with arbitrary parameters

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests