|
05/29/14, 11:44 PM | #1 |
|
I don't have an answer for you, but after glancing through this, my brain is screaming "anonymous closure".
Not sure that will do anything, though Lua is odd, but this code just bothers me at a gut level. Code:
Harvest.DataStore = { ["alikr"] = Harvest.DataStore[Harvest.langs]["alikr"], ........ } |
05/30/14, 12:36 AM | #2 | |
|
||
05/30/14, 12:39 AM | #3 |
The answer to 'how do I store this info' will largely rest on the question "What are you doing with the info?"
Note that you can store the information as sparsely as you need for storage purposes, and recombine them in game for speed of reference and create lookup tables and the like. |
|
05/30/14, 12:43 AM | #4 |
I am going to try this Lua console from source forge, no idea how to use it yet though. ^_^
Does anyone know a good Lua console that is easy to run like Python and Ruby? Lua Code:
That all works fine, so I have to build off of it and try to apply it to what I want with the map names. |
|
05/30/14, 01:07 AM | #5 | |
|
||
05/30/14, 01:38 AM | #6 | |
Lua Code:
|
||
05/30/14, 01:40 AM | #7 | |
Warning: Spoiler
Lua Code:
If you click the spoiler, as you can see I need to make it modular or I'll end up with a wall of text. Each map file is already over 1200 lines long.
Last edited by Sharlikran : 05/30/14 at 01:58 AM. |
||
05/30/14, 02:00 AM | #8 |
Lua Code:
|
|
05/30/14, 03:10 AM | #9 | |
Essentially: Code:
Harvest.DataStore.en.auridon.base Code:
Harvest = {} Harvest["DataStore"] = {} Harvest["DataStore"]["en"] = {} Harvest["DataStore"]["en"]["auridon"] = {} Harvest["DataStore"]["en"]["auridon"]["base"] = {} Code:
Harvest.DataStore_en_auridon_base Code:
Harvest = {} Harvest["DataStore_en_auridon_base"] = {} I suggest you read up on Lua, PiL is a good resource to learn the syntax of Lua |
||
05/30/14, 03:21 AM | #10 | |
As for your requirements, there are two ways you can go about it, depending on how often the information is requested. If the requests are relatively scarce, you can do as you do above, and just create functions that loop through the tables, til you find a match, then create a chunk of info for your use. If you need more speed, ie, your requests are very very often, you can create lookup tables in memory so that when you reference MapName["Aldunz"] it'll return { [Zone] : "alikr", [lang] : "en", [subzone] : "alikr_base", [map] : "Aldunz"}. This will frontload the work, by doing it all at load, but will speed up lookup. You just need to know what information you're using, and what format you need the result in. I advise you read up on how Lua handles tables and references first though, so you understand just what sort of structures you're creating. |
||
05/30/14, 07:21 AM | #11 | |
Last edited by Sharlikran : 05/30/14 at 08:24 AM. |
||
05/30/14, 07:47 AM | #12 | |
Instead of three line in the manifest like Code:
Localization/HarvestMapData-en.lua Localization/HarvestMapData-de.lua Localization/HarvestMapData-fr.lua Code:
Localization/HarvestMapData-$(language).lua Hope this help, --halja |
||
05/30/14, 08:19 AM | #13 |
Metatables
I understand that you want to store references from three different tables into the single table. If you use unique keys, it can be done using metatables. If you use just indexes (they are not unique), it will be much more complicated.
I don't know if it is exactly what you want, but I think it's worth of trying. Lua Code:
Metatables: http://nova-fusion.com/2011/06/30/lu...bles-tutorial/ http://lua-users.org/wiki/MetatableEvents http://lua-users.org/wiki/MetamethodsTutorial |
|
ESOUI » Developer Discussions » Lua/XML Help » Help with Complex Array. |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|