Help with Complex Array.
Help with Complex Array.
Localization/HarvestMapData-en.lua Localization/HarvestMapData-de.lua Localization/HarvestMapData-fr.lua I have three files in my manifest file listed like this. I have them that way to I can use a diff program like BeyoneCompare to line up the names so they are always in the exact sequence. Lua Code:
Lua Code:
Lua Code:
Lua Code:
Zone : alikr : lang : en : subzone : alikr_base : map : Aldunz Lua Code:
Lua Code:
EDIT: Nope none of my variations are working. |
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 = { |
Quote:
|
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. |
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. |
Quote:
|
Quote:
Lua Code:
|
Warning: Spoiler
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. Quote:
|
Lua Code:
|
Quote:
Essentially: Code:
Harvest.DataStore.en.auridon.base Code:
Harvest = {} Code:
Harvest.DataStore_en_auridon_base Code:
Harvest = {} I suggest you read up on Lua, PiL is a good resource to learn the syntax of Lua |
Quote:
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. |
Quote:
|
Quote:
Instead of three line in the manifest like Code:
Localization/HarvestMapData-en.lua Code:
Localization/HarvestMapData-$(language).lua Hope this help, --halja |
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 |
Quote:
|
Quote:
|
You don't need for loops to find if something exists in a table if you are not using an array. As long as it is a table, you can use keys like values to check if something exists and work from there. If you are not going to do table-to-table operations, or an operation that HAS to go through all the elements in a table (for example, counting), then you really don't need for loops for them.
http://www.esoui.com/forums/showthre...=8802#post8802 Code:
woodworking = { Code:
if woodworking |
Warning: Spoiler
So that we aren't talking about different code. I am going to try to attempt to convert that exact code to the metatable that Garkin mentioned and do effectively what Garkin and Wobin are talking about. I'll post again when I think I have figured it out. Also I removed the numbers because that was part of Undiscovered. Again the code is used with permission, in case anyone needs to know. So I don't care about the numbers unless the metatable tutorial specifies that I should use a sequential list of values for each map name. |
Quote:
Lua Code:
If you want faster translation, you have to use two tables: lua Code:
|
I love it Garkin thanks. I am still trying to cut and paste all the names from the file and organize it. Once I finally get it all done I'll let you know how it works. If I have any issues I'll see if you have time to help. Thanks again.
|
Lua Code:
Lua Code:
Lua Code:
Then each unique texture name would be Root. So everything imported from Esohead would go into Root. When a player loots a node, and it's in a unique location then the node would be evaluated against Root first. If it's not in Root and there is a unique location name, log it under the unique location name. I Am going to adapt Harvester to do this since it's not HarvestMap nobody will loose important data. Then I want to add that feature you have to grab the lorebook locations, and have it report the location names so I can collect them and hopefully some translations. Then I would have three keys, and when I know the Zone "therift" and SubZone "blessedcrucible7_base" then I only have to evaluate the location name. |
I think that you are making it overly complicated. If you use texture names you don't need location name.
Lua Code:
Quote:
|
Let me play with it. I wana try my idea. Can you help with something?
This is the string I have, "stonefalls/davonswatch_base" Lua Code:
textureName = "stonefalls/davonswatch_base" Lua Code:
textureName = "stonefalls/davonswatch_base/davonswatch" Lua Code:
textureName = "stonefalls/stonefalls_base" Lua Code:
Q1) Did I do it right? Q2) Why does 3 work in all cases. I tried a 2 for the first example with only v1, and v2 and I got a number and a string. |
Quote:
Lua Code:
Lua Code:
|
All times are GMT -6. The time now is 02:43 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI