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.
[SOLVED]Problems instantiating object in table
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
[SOLVED]Problems instantiating object in table
- 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.
Re: Problems instantiating object in table
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
Re: Problems instantiating object in table
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
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
Who is online
Users browsing this forum: No registered users and 3 guests