Contents of array gets reset for some reason...

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
tommcjeff
Prole
Posts: 3
Joined: Sat May 01, 2021 1:12 pm

Contents of array gets reset for some reason...

Post by tommcjeff »

I'm trying to make a wire placing system, however when I "place" the second segment of the "wire", it suddenly deletes all the contents, and won't work anymore. When I view the length of the array in console, it suddenly goes to 0 for some reason, however the rendering "engine" still works. I've attached a .love file
love.love
(977 Bytes) Downloaded 107 times
, in the top left corner it says the mode (viewing mode by default), and you can press space to start placing the "wire".
Last edited by tommcjeff on Wed Dec 22, 2021 9:45 am, edited 2 times in total.
User avatar
togFox
Party member
Posts: 828
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: Contents of array gets reset for some reason...

Post by togFox »

No love file attached. :(
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Turn-based PBEM horse stable (racing) management sim: https://togfox.itch.io/horse-stable-manager
https://discord.gg/HeHgwE5nsZ
User avatar
darkfrei
Party member
Posts: 1197
Joined: Sat Feb 08, 2020 11:09 pm

Re: Contents of array gets reset for some reason...

Post by darkfrei »

:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
tommcjeff
Prole
Posts: 3
Joined: Sat May 01, 2021 1:12 pm

Re: Contents of array gets reset for some reason...

Post by tommcjeff »

togFox wrote: Wed Dec 22, 2021 8:57 am No love file attached. :(
Sorry, the website was haveing some "issues" when I was posting (random 404's), so it must've not gotten posted.
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Contents of array gets reset for some reason...

Post by grump »

Not a huge fan of playing debugger for other people, but this was glaringly obvious by looking at it, so I make an exception just for you:

You're passing currentnodeid to placewirenode in love.mousepressed, when you should be passing currentwireid instead.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest