Saving custom defined parameters for luaentities.

Post Reply
sapier
Developer
Posts: 763
Joined: Tue Aug 16, 2011 18:17

Saving custom defined parameters for luaentities.

by sapier » Post

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
Moderator
Posts: 3944
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

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
Developer
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Post

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

User avatar
randomproof
Member
Posts: 214
Joined: Thu Nov 17, 2011 06:31
Location: California, USA

by randomproof » Post

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
Developer
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Post

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

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 3 guests