is there some specific reason you need to use dofile()? Otherwise, what's wrong with simply requiring a file? Perhaps you can explain a bit better why you require the function and include a .love? (Really though, read the forum rules)
Also I know I'm a nitpicking asshole but the word is spelled Lua and not LUA. It is its own word and not an acronym. For some reason it really grinds my gears when people do that...
Using dofile() ?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Using dofile() ?
I want to close the script, i am currently in and want to open a new script. This is simply what i want to do.is there some specific reason you need to use dofile()?
Re: Using dofile() ?
But why? Or, what you really want to do? Please follow the 5 Whys path: http://en.wikipedia.org/wiki/5_WhysWombat wrote:I want to close the script, i am currently in and want to open a new script. This is simply what i want to do.is there some specific reason you need to use dofile()?
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
Re: Using dofile() ?
Yeh please try and provide a bit more information with your questions, as you'll get more help, and the help you get will be more relevant.
Re: Using dofile() ?
Ok, i created a game with many scripts for another lua wrapper. Now i am going to convert my scripts for LÖVE andru it´s still works good.
I did my code in different scripts to have a better overview of my big project. With the lua wrapper i used before, changing the scripts where no problem, simply dofile("Script.lua"). But now for me, it is a bit complicated to change the script. Yes there´s is require, but require doesn´t close the current script and open a new one it only open a new script besides the current running.
Yes, i could write my code in a way that works with require. But it would be more work to convert it to LÖVE. So i simply ask you if it´s possible to simply change the scripts in LÖVE and close the current one.
When not, then it´s ok. Then i have to make the code with require. But first i have to check out if i can manage this with less work^^.
Thanks in advance and thanks for your help so far.
I did my code in different scripts to have a better overview of my big project. With the lua wrapper i used before, changing the scripts where no problem, simply dofile("Script.lua"). But now for me, it is a bit complicated to change the script. Yes there´s is require, but require doesn´t close the current script and open a new one it only open a new script besides the current running.
Yes, i could write my code in a way that works with require. But it would be more work to convert it to LÖVE. So i simply ask you if it´s possible to simply change the scripts in LÖVE and close the current one.
When not, then it´s ok. Then i have to make the code with require. But first i have to check out if i can manage this with less work^^.
Thanks in advance and thanks for your help so far.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Using dofile() ?
dofile does not end the execution of the script any more than either l.fs.load()() or require does.
Re: Using dofile() ?
yes, but when you combine dofile() with collectgarbage() and with setting all non-relevant variables to nil...
Re: Using dofile() ?
Ok, can you tell me a way to solve my problem then?
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Using dofile() ?
Well,
is technically equal to:
Code: Select all
dofile("some.lua")
Code: Select all
love.filesystem.load("some.lua")()
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 5 guests