Page 1 of 1

love.filesystem.load(file)(arguments)?

Posted: Thu Jul 12, 2012 6:42 pm
by furi
Pretty much the topic title. Is it possible to use arguments with a loaded lua file this way?

Re: love.filesystem.load(file)(arguments)?

Posted: Thu Jul 12, 2012 7:18 pm
by Robin
Have you tried it yourself?

I'm sorry I'm not answering your question (although my guess would be that the answer is "yes"), but for things like that, it's easier to just try it out yourself.

Re: love.filesystem.load(file)(arguments)?

Posted: Thu Jul 12, 2012 7:41 pm
by furi
Robin wrote:Have you tried it yourself?

I'm sorry I'm not answering your question (although my guess would be that the answer is "yes"), but for things like that, it's easier to just try it out yourself.
I have, but what will the arguments be named within the .lua file? I can't define them myself.

Re: love.filesystem.load(file)(arguments)?

Posted: Thu Jul 12, 2012 7:52 pm
by teomat
They are passed in the vararg parameter '...'

Edit: To clarify, you can either push them into a table like

Code: Select all

local args = {...}
and iterate over them
or extract them to local variables like

Code: Select all

local param1, param2 = ...

Re: love.filesystem.load(file)(arguments)?

Posted: Thu Jul 12, 2012 8:39 pm
by furi
teomat wrote:They are passed in the vararg parameter '...'

Edit: To clarify, you can either push them into a table like

Code: Select all

local args = {...}
and iterate over them
or extract them to local variables like

Code: Select all

local param1, param2 = ...
Thanks!