Saving custom defined parameters for luaentities.

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

Saving custom defined parameters for luaentities.

by sapier » Tue Jan 17, 2012 19:52

I'd like to add saving of custom defined parameters to luaentities. I've thought about multiple options:

A) The "full" solution means include support for nested tables. Easyest way to support it would be using xml. This most likely would add a library depencence. But it would preserve world compatibility.

B) no recursion, no tables. Only name and value get saved.

C) any other suggestion that's better and I haven't thought of
Last edited by sapier on Tue Jan 17, 2012 19:52, edited 1 time in total.
DON'T mention coding style!
(c) sapier all rights reserved
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Tue Jan 17, 2012 19:56

Good Idea at all!
+5 for the whole Idea
+2 for A
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Thu Jan 19, 2012 20:31

ok seems there aren't many people interested at all. In this case and as celeron doesn't like adding new libs (what I understand) I don't see any chance to get this into master.

Sorry I'll do other things first.
DON'T mention coding style!
(c) sapier all rights reserved
 

randomproof
Member
 
Posts: 214
Joined: Thu Nov 17, 2011 06:31

by randomproof » Thu Jan 19, 2012 22:28

sapier wrote:I'd like to add saving of custom defined parameters to luaentities. I've thought about multiple options:

A) The "full" solution means include support for nested tables. Easyest way to support it would be using xml. This most likely would add a library depencence. But it would preserve world compatibility.

B) no recursion, no tables. Only name and value get saved.

C) any other suggestion that's better and I haven't thought of

I don't understand what you mean. What are you trying to save that you can't do now using 'on_activate' and 'get_staticdata'?
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Fri Jan 20, 2012 17:30

Yes this can be done. And I've already used it for mod animals. But as staticdata is a string so all serialization and deserialization has to be done by mod code. Having only 1 parameter this isn't any problem at all. When using multiple parameters as animals mod does this is lot of work to do. In animals eg I've accepted not saving some parameters that might improove mob behaviour because of overhead generated by serialization/deserialization. And of course because coding a generic solution in lua is lot of (possibly useless) work.
And of course this feature isn't exactly a feature related to any mod at all it's a generic entity capability so at least some mods would need to implement similar/the same features.

There's obviously another possible but slow option I haven't mentioned in my starting post:

D) implement serialization and deserialization in lua
DON'T mention coding style!
(c) sapier all rights reserved
 


Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 10 guests

cron