Nothing happens when I call function in other script/file?

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.
ziodice
Prole
Posts: 15
Joined: Thu Feb 23, 2012 8:35 pm

Re: Nothing happens when I call function in other script/fil

Post by ziodice »

New error: [string "lev1.lua"]:10: bad argument #4 to 'circle' (number expected, got no value).
I must be REALLY bad at this...
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Nothing happens when I call function in other script/fil

Post by Nixola »

[string "lev1.lua"]:10: bad argument #4 to'circle' (number expected, got no value).
It means that, in the file 'lev1.lua', at the 10th line, you didn't type the 4th argument of the 'circle' function... In other words, you tell LOVE where to draw the circle, but you don't tell it its radius
Last edited by Nixola on Thu Feb 23, 2012 10:23 pm, edited 1 time in total.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ziodice
Prole
Posts: 15
Joined: Thu Feb 23, 2012 8:35 pm

Re: Nothing happens when I call function in other script/fil

Post by ziodice »

Oh...I really should pay attention to how many arguments I have to put in. I made this mostly by combining tutorials, and I KIND of understand the code. Thank you!
ziodice
Prole
Posts: 15
Joined: Thu Feb 23, 2012 8:35 pm

Re: Nothing happens when I call function in other script/fil

Post by ziodice »

Uh...I put in

Code: Select all

objects.ball.shape:getRadius()
, but I still get the error

edit:
I even tried replacing that with an actual number, still get the error
ziodice
Prole
Posts: 15
Joined: Thu Feb 23, 2012 8:35 pm

Re: Nothing happens when I call function in other script/fil

Post by ziodice »

OKAY, so, I managed to stop all errors, but, upon pressing enter it just flashes. If it's clearing, then redrawing everything, that's bad. Because I want it to just draw back the ball and the ground. As far as I know, that's all I told it to do. When I call a function from another file, does it go back and run main again? I'm confused.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Nothing happens when I call function in other script/fil

Post by Robin »

You might want to read love.run. It explains what happens when you run a game, what functions are called. (Hint: it's all in a big ol' loop.)
Help us help you: attach a .love.
ziodice
Prole
Posts: 15
Joined: Thu Feb 23, 2012 8:35 pm

Re: Nothing happens when I call function in other script/fil

Post by ziodice »

Hmm, I can see how that might be a problem...any way for me to make it stay on the "lev1" file?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Nothing happens when I call function in other script/fil

Post by Robin »

I don't think I understand your question. Could you clarify?
Help us help you: attach a .love.
coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

Re: Nothing happens when I call function in other script/fil

Post by coffee »

Are you using "requires" for loading different levels? Do you will "require" a lot of levels? IMHO I think it's a better tecnique use

Code: Select all

load_level = love.filesystem.load( wanted_level_file )
	run_level = load_level()

to pump the files and replace with new level data or new functions needed instead of require multiples levels files.
ziodice
Prole
Posts: 15
Joined: Thu Feb 23, 2012 8:35 pm

Re: Nothing happens when I call function in other script/fil

Post by ziodice »

Um...I'm kind of new, so I'm not sure what to type to ACTIVATE those variables, if that's even what I'm supposed to do...
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 41 guests