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
Saving custom defined parameters for luaentities.
Saving custom defined parameters for luaentities.
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
(c) sapier all rights reserved
- randomproof
- Member
- Posts: 214
- Joined: Thu Nov 17, 2011 06:31
- Location: California, USA
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 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
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
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
(c) sapier all rights reserved
Who is online
Users browsing this forum: Google [Bot] and 3 guests