[SOLVED] (HUMP) 'Gamestate.switch' changes the references of the tables passed in 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.
Post Reply
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

[SOLVED] (HUMP) 'Gamestate.switch' changes the references of the tables passed in parameters

Post by Bigfoot71 »

I noticed that when I passed tables as a parameter with Gamestate.switch(to, ...) the reference of this table was no longer the same, which caused me errors in a larger project where I put an instantiated class as a parameter and where its previously initialized values ​​ended up on nil.

Here is an example to download that I did quickly to illustrate the problem, you have to see in the console for the references.
Attachments
Test-States.love
(4.2 KiB) Downloaded 87 times
Last edited by Bigfoot71 on Wed Nov 09, 2022 8:28 pm, edited 1 time in total.
My avatar code for the curious :D V1, V2, V3.
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Re: (HUMP) 'Gamestate.switch' changes the references of the tables passed in parameters

Post by Bigfoot71 »

My apologies, I didn't understand but the "method" :enter() takes a first parameter, I'll leave you this link to the doc which explains this if it ever happens to someone someone else: https://hump.readthedocs.io/en/latest/g ... ate.switch

Always RTFM, sorry ^^
My avatar code for the curious :D V1, V2, V3.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 10 guests