window:247:bad argument: double expected, got nil
Started by Konlab, May 23 2014 11:11 AM
12 replies to this topic
#1
Posted 23 May 2014 - 11:11 AM
Hi!
I'm developing a game, called GoDeeper!
But I have a problem: if I begin the game and I press a key then: "window:247:bad argument: double expected, got nil"
please fix!
pastebin link: http://pastebin.com/LghsK2Yv
Also in lua are doubles?
I know, in C are doubles, and the lua is written in C. But please fix!
I'm developing a game, called GoDeeper!
But I have a problem: if I begin the game and I press a key then: "window:247:bad argument: double expected, got nil"
please fix!
pastebin link: http://pastebin.com/LghsK2Yv
Also in lua are doubles?
I know, in C are doubles, and the lua is written in C. But please fix!
#2
Posted 23 May 2014 - 12:38 PM
term.setCursorPos(xto,yto) --this line is passed nil, 1 function go() --# cur & next have not been defined, thus prev is set to nil prev = cur cur = next next = math.random(2,25) level(prev,1) --#this line passes nil, 1 level(cur,2) level(next,3) end
#3
Posted 23 May 2014 - 12:43 PM
And at the line 5 and at the line 6 cur and next are defined
KingofGamesYami, on 23 May 2014 - 12:38 PM, said:
term.setCursorPos(xto,yto) --this line is passed nil, 1 function go() --# cur & next have not been defined, thus prev is set to nil prev = cur cur = next next = math.random(2,25) level(prev,1) --#this line passes nil, 1 level(cur,2) level(next,3) end
#4
Posted 23 May 2014 - 04:19 PM
Konlab, on 23 May 2014 - 11:11 AM, said:
Also in lua are doubles?
I know, in C are doubles, and the lua is written in C.
I know, in C are doubles, and the lua is written in C.
But yes, there are doubles in Lua and LuaJ, in fact everything is a double, which I personally am not too keen on.
local someDouble = 5.2 --# Works! local someInt = 5 --# Works, too. print(type(someInt)) --# Prints "number". print(type(someDouble)) --# Prints "number".
From that we can conclude that there aren't really number types in Lua and thusly everything counts as a "number" type.
#5
Posted 23 May 2014 - 04:29 PM
I know what is double and what is int, because I learn C, too.
Please send me the fixed code.
KingofGamesYami, on 23 May 2014 - 12:38 PM, said:
term.setCursorPos(xto,yto) --this line is passed nil, 1 function go() --# cur & next have not been defined, thus prev is set to nil prev = cur cur = next next = math.random(2,25) level(prev,1) --#this line passes nil, 1 level(cur,2) level(next,3) end
Please send me the fixed code.
#6
Posted 23 May 2014 - 04:35 PM
That's not how Ask a Pro works, generally. He's pointed out the issue causing the error, so you should at least try to go fix the problem yourself rather than just demanding fixed code. We aren't here to write your program for you, merely to help you learn how to fix it yourself. Sometimes people do decide to provide code as well, but that is at their discretion, and is usually only because the question asker has put a lot of effort into the question.
#7
Posted 23 May 2014 - 04:37 PM
I am trying to fix the code 10 hours ago I'm working only on it, but still gives an error
#8
Posted 23 May 2014 - 04:39 PM
Then post the current code and the full text of the error you get while running it.
#9
Posted 23 May 2014 - 04:42 PM
I run the code and I get: Crashed:<and the title of the post>
The Crashed is because I used pcall()
The Crashed is because I used pcall()
#10
Posted 23 May 2014 - 04:44 PM
So, you haven't changed anything in the code since you posted it on the pastebin link in the first post? You should make the changes suggested by KingOfGamesYami and try running it again.
#11
Posted 23 May 2014 - 05:26 PM
But the KingOfGamesYani's version and between the first version isn't any difference!
#13
Posted 23 May 2014 - 05:51 PM
Konlab, on 23 May 2014 - 05:26 PM, said:
But the KingOfGamesYani's version and between the first version isn't any difference!
He is suggesting where you need to make changes in the code. You have to go back and actually fix it rather than just expecting the fix to be handed to you on a silver platter. We are trying to show you where the problem is and help you learn why it occurred and how to fix it, which will be more helpful to you in the long run. You have to invest some effort into this process as well, instead of just posting a problem and sitting around demanding that someone post a completely fixed piece of code.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











