Thanks!
Well, many people use some kind of class system in their games, especially for entities (player objects, enemies...) and the like. The problem is that if you serialise a class instance as a table and then de-serialise it, it doesn't work as expected. That's where Lady comes in. It detects class instances and generates the right code to make everything work seamlessly.
Lady: making savegames easy
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Lady: making savegames easy
Help us help you: attach a .love.
Re: Lady: making savegames easy
Look cool. But if I would solve the problem, I would create an additional table. And would use this table to record the data (health, attack power, and etc).
Watch your code, and it's very cool too. Continue develop! Thanks!)
Watch your code, and it's very cool too. Continue develop! Thanks!)
My library for easy saving Slib! Try this! Now you can encrypt your save!
- Drop of light LD#30
- OUTRANGE LD#31
(Sorry for my english. I learn it myself, and I don't have enough experience)
- Drop of light LD#30
- OUTRANGE LD#31
(Sorry for my english. I learn it myself, and I don't have enough experience)
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Lady: making savegames easy
Thanks.
I didn't understand what you mean in this part:
I didn't understand what you mean in this part:
Do you mean you would use a table instead of classes? Or use a single table instead of multiple tables to hold the state? Or something else?Snuux wrote:I would create an additional table. And would use this table to record the data (health, attack power, and etc).
Help us help you: attach a .love.
Re: Lady: making savegames easy
Something like this.
But now I starting understand, how your library can save my time and code...
Code: Select all
Entity= Class('Entity')
Entity.stats = { hp = 100, dmg = 50, range = 5 }
function Entity.initialize()
Entity.stats = loadSavedTable()
end
function Entity.save()
saveTable(Entity.stats)
end
My library for easy saving Slib! Try this! Now you can encrypt your save!
- Drop of light LD#30
- OUTRANGE LD#31
(Sorry for my english. I learn it myself, and I don't have enough experience)
- Drop of light LD#30
- OUTRANGE LD#31
(Sorry for my english. I learn it myself, and I don't have enough experience)
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Lady: making savegames easy
Well, it took nearly 200 lines of code, but Joints are now supported.
With the Love-Jam going on, Lady should be the perfect way to easily add a save and load feature to your jam entry!
With the Love-Jam going on, Lady should be the perfect way to easily add a save and load feature to your jam entry!
Help us help you: attach a .love.
Re: Lady: making savegames easy
A very helpful addition would be support for hump.vector (with an optional z and w param, since i use a custom vector3d lib too). Serializing vectors and then needing to reestablish their vectorness is annoying
Otherwise, nice lib!
Otherwise, nice lib!
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Lady: making savegames easy
To use hump.vector, simply register it:
Similarly for your vector3d.
Lady needs to know beforehand what kind of classes you're using, so it can do the right thing when loading a savegame.
Code: Select all
local lady = require 'lady'
local vector = lady.register_class(require 'hump.vector', 'vector')
Lady needs to know beforehand what kind of classes you're using, so it can do the right thing when loading a savegame.
Help us help you: attach a .love.
Re: Lady: making savegames easy
Ah! I haven't looked into how this works so I didn't know it was modular.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
Re: Lady: making savegames easy
Hi I wasn't sure where to ask this, so I'm asking here.
I'm trying to use Lady for saving a roguelike map, but load_all is returning an error saying that on line 544 in lady argument #1 for function setfenv is nil. save_all works fine, I checked the savefile and everything seemed ok. How can I solve this?
I'm trying to use Lady for saving a roguelike map, but load_all is returning an error saying that on line 544 in lady argument #1 for function setfenv is nil. save_all works fine, I checked the savefile and everything seemed ok. How can I solve this?
- ejmr
- Party member
- Posts: 302
- Joined: Fri Jun 01, 2012 7:45 am
- Location: South Carolina, U.S.A.
- Contact:
Re: Lady: making savegames easy
setfenv() was removed in Lua 5.2. LÖVE uses LuaJIT, however, which maintains a lot of compatibility with Lua 5.1 and thus still has setfenv(). So my guess is that you are trying to run your code with a verison of Lua that no longer supports setfenv().
Who is online
Users browsing this forum: No registered users and 5 guests