should be textboxes[1].text (same for the other ones)MysticPing2 wrote:Im trying to do this and im getting a syntax error on the first line, any idea why?Code: Select all
pop = tonumber(textboxes[1.text]) income = tonumber(textboxes[2.text]) tax = tonumber(textboxes[3.text]) healthcare = tonumber(textboxes[4.text]) education = tonumber(textboxes[5.text])
i think i know the problem, unsure on how to fix it
Hello, trying to print a text i input
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Hello, trying to print a text i input
-
- Prole
- Posts: 33
- Joined: Tue Dec 10, 2013 7:08 pm
Re: Hello, trying to print a text i input
Ok, last time i need help, i want it to update every secound and print output2, but its not working, im using a delta time loop.
And thanks for everything sofar, ive learned ALOT
And thanks for everything sofar, ive learned ALOT
- Attachments
-
- Tax.love
- (1.82 KiB) Downloaded 67 times
Re: Hello, trying to print a text i input
Drawing calls outside of love.draw() aren't drawn, this include love.graphics.print, What exactly do you want it to do? Should it print output2 constantly and update it every second?MysticPing2 wrote:Ok, last time i need help, i want it to update every secound and print output2, but its not working, im using a delta time loop.
And thanks for everything sofar, ive learned ALOT
Also you have an unnecessary nested loop in love.draw (a loop within a loop), You can use an ipairs loop for the comments as well as the textboxes.
Last edited by veethree on Thu Dec 12, 2013 7:24 pm, edited 1 time in total.
-
- Prole
- Posts: 33
- Joined: Tue Dec 10, 2013 7:08 pm
Re: Hello, trying to print a text i input
I want it to print output, but output 2 (which is a stringified output) doesnt exist untill after i have filled in the text boxes, i thought i could check this every second.
Re: Hello, trying to print a text i input
You can print numbers directly, So there's no need for the output2 variable. Also the getwpop function is never called, so the code in it isn't executed.MysticPing2 wrote:I want it to print output, but output 2 (which is a stringified output) doesnt exist untill after i have filled in the text boxes, i thought i could check this every second.
Also you put love.update() into that function, You generally don't want a functions inside of other functions.
Aside from the nested loop in love.draw, You're also setting the background color multiple times every frame (inside of the comments loop), You generally don't need to do that unless the backgroundcolor is changed on runtime, If it's not just put that into love.load()
Another thing is you usually want to make any variables inside a function that aren't used anywhere outside of it local, More information on that here.
I fixed up alot of those things, You can compare it to your original code to see what exactly i did. I did remove love.update completely as it wasn't necessary, And i set it up so getwpop() is called when you press space, note that will cause a crash if you haven't filled in the textboxes, or filled them in with letters instead of numbers.
- Attachments
-
- main.lua
- (3.87 KiB) Downloaded 67 times
-
- Prole
- Posts: 33
- Joined: Tue Dec 10, 2013 7:08 pm
Re: Hello, trying to print a text i input
My post didnt get posted, AGAIN but thanks, althou i cant export it for some tupid reason, im doing exactly as the tutorials says -.- but g2g
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 3 guests