Search found 3 matches

by MalinGraham
Wed Jan 25, 2017 7:07 pm
Forum: Support and Development
Topic: How do I round a number in Lua?
Replies: 2
Views: 11087

How do I round a number in Lua?

I have seen people use math.floor but I do not quite understand it.

I want the program to round to the nearest integer and return it.
I don't mind if someone just gives me a rounding system as long as I understand it
by MalinGraham
Wed Jan 25, 2017 2:38 pm
Forum: Support and Development
Topic: Error Message attempt to index a nil val
Replies: 4
Views: 2566

Re: Error Message attempt to index a nil val

Hello and welcome to the forums! Your problem is really simple: you have "tiles" table, but not "tiles[tileNumber]" table. You have to create it before you can put values into it. tiles[tileNumber] = { } I am using tileNumber to find an index in the tiles table, I didn't want tw...
by MalinGraham
Wed Jan 25, 2017 2:25 pm
Forum: Support and Development
Topic: Error Message attempt to index a nil val
Replies: 4
Views: 2566

Error Message attempt to index a nil val

When running this code, line 13 causes the error message. tiles = {} --tiles{{"tileNumber","xCoordinate", "yCoordinate"}} tileNumber = 0 wHeight = love.graphics.getHeight() wWidth = love.graphics.getWidth() function tileCreate() for x=0, wWidth, 50 do for y=0, wHeight, ...