[SOLVED]Problems instantiating object in table

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.
Post Reply
pauls313
Citizen
Posts: 50
Joined: Tue Aug 02, 2016 3:07 am

[SOLVED]Problems instantiating object in table

Post by pauls313 »

There is a table named Items, and all of its contents is rendered every frame on screen. I have a Instantiate function that picks an item from the presets list and instantiates it in the given coordinates. The problem is that, when loading the map, all of the instantiated items seem to be in the same position (10,5). This problem has been bothering for hours, could someone take a look at my code?

Oh, and ignore those buttons on screen. I was going to add the controls but when the items problem appeared I had to stop.
Attachments
Space.love
(644.9 KiB) Downloaded 86 times
Last edited by pauls313 on Mon Jan 23, 2017 2:48 pm, edited 1 time in total.
pauls313
Citizen
Posts: 50
Joined: Tue Aug 02, 2016 3:07 am

Re: Problems instantiating object in table

Post by pauls313 »

I just downloaded the file in my PC and realized it's completely fucked. I made a quick rearrangement so that you can at least see what is happening
Attachments
Space Station 22.love
(644.46 KiB) Downloaded 79 times
pauls313
Citizen
Posts: 50
Joined: Tue Aug 02, 2016 3:07 am

Re: Problems instantiating object in table

Post by pauls313 »

Nevermind, someone else helped me find the problem.

In util.lua, using "local instance = preset" didn't work, I had to use

local instance = {}
for k, v in pairs(preset) do instance[k] = v end
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests