Love Editor [I need help!]

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Love Editor [I need help!]

Post by Roland_Yonaba »

yegorf1 wrote:But I don't know Lua and Love so good to do it at one, for example I don't know how to make file saving. And I think what isn't if I call help ^^
Well, this have been discussed a lot of times around. You can try the search button.
Basically, you can use Lua IO. See Pil, this a free online book, to learn Lua. File IO is discussed here.
Also - and this is recommended with Löve, as far as I know - you can use love.filesystem (which have some limitations).
yegorf1
Prole
Posts: 19
Joined: Tue Dec 25, 2012 7:46 pm

Re: Love Editor [I need help!]

Post by yegorf1 »

Roland_Yonaba wrote:
yegorf1 wrote:But I don't know Lua and Love so good to do it at one, for example I don't know how to make file saving. And I think what isn't if I call help ^^
Well, this have been discussed a lot of times around. You can try the search button.
Basically, you can use Lua IO. See Pil, this a free online book, to learn Lua. File IO is discussed here.
Also - and this is recommended with Löve, as far as I know - you can use love.filesystem (which have some limitations).
I wanted do with love.filesystem
yegorf1
Prole
Posts: 19
Joined: Tue Dec 25, 2012 7:46 pm

Re: Love Editor [I need help!]

Post by yegorf1 »

Roland_Yonaba wrote: Basically, you can use Lua IO. See Pil, this a free online book, to learn Lua.
Do you know russia books? :awesome:
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Love Editor [I need help!]

Post by BlackBulletIV »

Try to avoid double posting. Instead, edit your last post. (Unless of course the topic's fallen off the first page, which generally takes a few days.)
User avatar
Ubermann
Party member
Posts: 146
Joined: Mon Nov 05, 2012 4:00 pm

Re: Love Editor [I need help!]

Post by Ubermann »

yegorf1 wrote:
I wanted do with love.filesystem
Maybe this can help you.

It is a small part of the "save game" algorithm in a project I'm developing:

Code: Select all

local savePlayer = nil
	
savePlayer = "player.x = " .. player.x
savePlayer = savePlayer .. "\nplayer.y = " .. player.y
	
savePlayer = savePlayer .. "\nplayer.level = " .. player.level
savePlayer = savePlayer .. "\nplayer.expToLevel = " .. player.expToLevel
savePlayer = savePlayer .. "\nplayer.exp = " .. player.exp
savePlayer = savePlayer .. "\nplayer.selectedWeapon = " .. player.selectedWeapon
	
savePlayer = savePlayer .. "\nplayer.maxHealth = " .. player.maxHealth
savePlayer = savePlayer .. "\nplayer.health = " .. player.health
	
success = love.filesystem.write("player.save", savePlayer)
Basically what it does is to save game variables as a string plus the variable value. (plus = concatenation, not math operation)
Then write it to HDD using love.filesystem.

Next, when you load the saved file, LÖVE will execute everything as if it were a normal Lua module.

You can do it like this:

Code: Select all

ok, chunk = pcall(love.filesystem.load, "player.save" )

chunk()
If you read the LÖVE wiki you will see that loading the file only with love.filesystem.load WILL NOT execute it's contents.
You need to call it manually, that is because in the example I added a chunk() statement because without it, chunk will only be a variable with some values assigned (the values you saved into the file previously)
yegorf1
Prole
Posts: 19
Joined: Tue Dec 25, 2012 7:46 pm

Re: Love Editor [I need help!]

Post by yegorf1 »

Ubermann wrote:
yegorf1 wrote:
I wanted do with love.filesystem
Maybe this can help you.

It is a small part of the "save game" algorithm in a project I'm developing:

Code: Select all

local savePlayer = nil
	
savePlayer = "player.x = " .. player.x
savePlayer = savePlayer .. "\nplayer.y = " .. player.y
	
savePlayer = savePlayer .. "\nplayer.level = " .. player.level
savePlayer = savePlayer .. "\nplayer.expToLevel = " .. player.expToLevel
savePlayer = savePlayer .. "\nplayer.exp = " .. player.exp
savePlayer = savePlayer .. "\nplayer.selectedWeapon = " .. player.selectedWeapon
	
savePlayer = savePlayer .. "\nplayer.maxHealth = " .. player.maxHealth
savePlayer = savePlayer .. "\nplayer.health = " .. player.health
	
success = love.filesystem.write("player.save", savePlayer)
Basically what it does is to save game variables as a string plus the variable value. (plus = concatenation, not math operation)
Then write it to HDD using love.filesystem.

Next, when you load the saved file, LÖVE will execute everything as if it were a normal Lua module.

You can do it like this:

Code: Select all

ok, chunk = pcall(love.filesystem.load, "player.save" )

chunk()
If you read the LÖVE wiki you will see that loading the file only with love.filesystem.load WILL NOT execute it's contents.
You need to call it manually, that is because in the example I added a chunk() statement because without it, chunk will only be a variable with some values assigned (the values you saved into the file previously)
Ubermann, thanks, I think it will be very helpful (or useful I don't know ^^)
yegorf1
Prole
Posts: 19
Joined: Tue Dec 25, 2012 7:46 pm

Re: Love Editor [I need help!]

Post by yegorf1 »

Code: Select all

ok, chunk = pcall(love.filesystem.load, "player.save" )

chunk()
what is ok and pcall ?
yegorf1
Prole
Posts: 19
Joined: Tue Dec 25, 2012 7:46 pm

Re: Love Editor [I need help!]

Post by yegorf1 »

thanks google for pcall :)
jjmafiae
Party member
Posts: 1331
Joined: Tue Jul 24, 2012 8:22 am

Re: Love Editor [I need help!]

Post by jjmafiae »

yegorf1 wrote:Hi, all!

Please help me with my project!
Status: opening file, syntax finding/

I'm a C# programmer and when I found a Love framework it was awesome! But when i start finding for a good compiler I didn't find it. And now I working on Love Editor on what i started making on Love. But I don't know Lua and Love so good to do it at one, for example I don't know how to make syntax. And I think what isn't if I call help ^^

P.S. I'm sorry for my english beacose I'm russia user :)

Source (Last): http://www.mediafire.com/?b03zr1uw31gygdg

Old versions:
-- http://www.mediafire.com/?8726652aqx064i2
-- http://www.mediafire.com/?7ku0br062opaktr
-- http://www.mediafire.com/?ayjcc57cpz5wt39

P.S. If you downloaded please write at topic.

Good day!

dude are you russian that's awsome could you translate a few things for me?
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests