Ok, I wrote this game... I go run it in LOVE and it says......................
"main:lua:25: incorrect number of parameters
Traceback
[c]:in function 'newWorld'
main.lua:25: in function 'load'
[c]:in function 'xpcall' "
I'm confused on this error, it is forever hard to find support on this language compared to C++ and Java. I am running windows 7 64bit if that has anything to do with it i do not know... Please if anyone can please assist me in this manner please give me any tips or what is exactly causing this issue. This is my first LUA program ever and all i can say is I like PHP a lot better and i miss my java compilers <----me being sad
I added the whole game and all files in a zip file, When i unzip and drag and drop main.lua onto love icon is when error is thrown.
Thank You so much,
Anthony
ERROR
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
ERROR
- Attachments
-
- artillary.zip
- GAME Artillary
- (1.14 MiB) Downloaded 178 times
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: ERROR
As the error tells you, it's at line 25 of main.lua, which is indeed a call to love.physics.newWorld. The docs tell you that newWorld requires 4 parameters now, which makes your 2 parameter call wrong, as the error states.
Re: ERROR
I'm slightly confused why the line was asking for a integer on the res for physics? Also line 278 I'm printing text its asking for a string, and says the print is nil? You all know of any good referrences that I could read up on, or get proper syntax for these functions so I don't keep butchering this? Everything has been on a fly with this
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: ERROR
Programming in Lua is a good book on Lua.
And don't despair so easily, it's not like you're going to get everything right with a first program.
And don't despair so easily, it's not like you're going to get everything right with a first program.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: ERROR
As the documentation on love.physics.newWorld will tell you, you need to give it four parameters. This was different in the past.
The variable "text" is nil, because it is not set until some specific collision occurs.madbaho wrote:Also line 278 I'm printing text its asking for a string, and says the print is nil?
The PIL, for example.madbaho wrote:You all know of any good referrences that I could read up on, or get proper syntax for these functions so I don't keep butchering this? Everything has been on a fly with this
Help us help you: attach a .love.
- slime
- Solid Snayke
- Posts: 3161
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: ERROR
The online version of PIL is many years out of date and references some obsolete/deprecated things. There's also the Lua-users Tutorial, the PIL book, and many other resources found through the googles.
The LÖVE Wiki does a decent job of documenting things specific to LÖVE, and looking at other people's code can also help a lot.
The LÖVE Wiki does a decent job of documenting things specific to LÖVE, and looking at other people's code can also help a lot.
Re: ERROR
I tried another tutorial, I went line by line and I still have an issue with another print statement... I check and view and I cannot find a solution. The only issue was with the collision, before i added the collision it worked great.
Tutorial
http://www.brighthub.com/hubfolio/matth ... -love.aspx
Each link is another step you see on that page... I was on Collision Detection, ran into an issue so i finished the weapons step and trying to fix collision now.
syntax error:collisionmanager.lua:26:'=' expected near 'order'
I double checked and double checked with tutorial and I cannt find my problem? Anyone help? My code matches exactly
Tutorial
http://www.brighthub.com/hubfolio/matth ... -love.aspx
Each link is another step you see on that page... I was on Collision Detection, ran into an issue so i finished the weapons step and trying to fix collision now.
syntax error:collisionmanager.lua:26:'=' expected near 'order'
I double checked and double checked with tutorial and I cannt find my problem? Anyone help? My code matches exactly
- Attachments
-
- demogame.zip
- My space game tutorial
- (575.96 KiB) Downloaded 129 times
Re: ERROR
This line is:madbaho wrote:syntax error:collisionmanager.lua:26:'=' expected near 'order'
Code: Select all
print("collide")In order
You must have made a mistake copying and pasting from the tutorial. Remove "In order" from that line and try running the game again.
Cheers,
Andre
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: ERROR
Some general advice:
- Indent. I've attached a .love which has marginally improved indentation. It'll help you keep track of where you are and what you're doing in your code.
- Use PO2 images so that computers that can't render them will still be able to play.
- Don't require anything more than once. One, its not doing anything code-wise, and two, it encourages bad coding habits. Only require class once.
- Comment everything that isn't self evident. I will often put the why in my comments, like this:
I've attached a .love (the preferred format for distributing code around here) with some adjustments based on the advice above. Good luck!
- Indent. I've attached a .love which has marginally improved indentation. It'll help you keep track of where you are and what you're doing in your code.
- Use PO2 images so that computers that can't render them will still be able to play.
- Don't require anything more than once. One, its not doing anything code-wise, and two, it encourages bad coding habits. Only require class once.
- Comment everything that isn't self evident. I will often put the why in my comments, like this:
Code: Select all
player.y = player.y - 32 -- Move up by 32 so that the next update doesn't also collide
- Attachments
-
- space.love
- v2
- (574.71 KiB) Downloaded 149 times
Last edited by tentus on Sun Mar 13, 2011 9:33 am, edited 1 time in total.
Kurosuke needs beta testers
Re: ERROR
your demo give me a error when i hit space bar was that meant to be a error demo ?tentus wrote:Some general advice:
- Indent. I've attached a .love which has marginally improved indentation. It'll help you keep track of where you are and what you're doing in your code.
- Use PO2 images so that computers that can't render them will still be able to play.
- Don't require anything more than once. One, its not doing anything code-wise, and two, it encourages bad coding habits. Only require class once.
- Comment everything that isn't self evident. I will often put the why in my comments, like this:I've attached a .love (the preferred format for distributing code around here) with some adjustments based on the advice above. Good luck!Code: Select all
player.y = player.y - 32 -- Move up by 32 so that the next update doesn't also collide
Sir Kittenface
Möko IDE Codename (Erös) Returns Soon
I am dyslexic so if any of my replys confusing please just ask me to reword it as this will make things a lot easier for all parties lol.
Möko IDE Codename (Erös) Returns Soon
I am dyslexic so if any of my replys confusing please just ask me to reword it as this will make things a lot easier for all parties lol.
Who is online
Users browsing this forum: Ahrefs [Bot] and 4 guests