11/18/14, 12:30 PM | #1 |
Converting Bank Manager Revived from LAM-1.0 to LAM-2.0
I am puzzled about a problem I have.
The code using LAM-1.0 is this: Lua Code:
Lua Code:
Any idea how I can fix this? Last edited by SnowmanDK : 11/18/14 at 01:38 PM. |
|
11/18/14, 12:50 PM | #2 |
|
Looping over the block does nothing. You'd need to build-up a table by appending each entry from the loop:
Lua Code:
Alternatively, if you want to stick to the function-based style (rather than make the table yourself), you can take a look at: http://www.esoui.com/downloads/info5...Interface.html You'd have to extend it for any of the new LAM2 features (like texture), but it is something to consider. |
11/18/14, 01:08 PM | #3 | |
Guess I am gonna do it the hard way, by adding them one by one instead. I already converted most of the settings menu, but thanks for the input |
||
11/18/14, 01:38 PM | #4 |
lol don't know why I wrote "Destinations" in topic.
It IS Bank Manager Revived I am working on at the moment. |
|
11/18/14, 02:20 PM | #5 |
|
That likely means you have something evil before the for. When I simply pasted the piece from your initial post into Lua console, I got unexpected symbol near '{' (which was kind of expected )
edit: probably some unclosed braces... |
11/18/14, 03:24 PM | #6 |
|
Ah yeah. If you're trying to do something along these lines it'd throw the error at the for statement because you can't have a for statement within a table.
Lua Code:
Might go ahead and throw the full function/file on pastebin or something so can better see what the error is. |
11/18/14, 03:48 PM | #7 | |
I can see Sasky pointed the problem out On with the job the oldfashion way, I guess |
||
11/18/14, 06:15 PM | #8 |
Check how it is done in HarvestMap addon.
Lua Code:
|
|
11/18/14, 07:39 PM | #9 | |
I am seriously scratching my head over this, though, as I can't figure out how to convert it to a format that will be accepted: Lua Code:
Lua Code:
|
||
11/18/14, 09:51 PM | #10 |
Your original code modified to use table.insert (I assume that your table with options is called "optionsTable"):
Lua Code:
Modified code if you use metatable as it is in HarvestMaps addon (again, I assume that you use "optionsTable"): Lua Code:
|
|
11/19/14, 11:38 AM | #11 | |
This part works fine with no issues: Lua Code:
Lua Code:
Code:
user:/AddOns/BankManagerRevived/UI/BankManagerOpts.lua:351: unexpected symbol near 'for' |
||
11/19/14, 12:26 PM | #12 |
|
You're still failing to understand the basic fact that you cannot put a for loop (or any other non-expression statement, for that matter), into table definition (or any other place where an expression is expected, for that matter).
Lua Code:
|
11/19/14, 01:12 PM | #13 | |
EDIT: you mean I have to move the loop into a function of its own and call that? |
||
11/19/14, 03:15 PM | #14 |
|
Read carefully. You have to move the for loop out of the table constructor. What works in HarvestMap is valid Lua code, yours isn't.
Sasky showed you what's wrong with your code, Garkin gave you a prefectly valid example, yet you still keep that loop in the table. Just paste what I posted above, with no crap around it. I didn't bother to fix indentation, but the braces are fixed. |
11/19/14, 03:16 PM | #15 |
You can't use for loop in the table definition. You have to close table definition first and then add items to that table.
Lua Code:
|
|
11/19/14, 04:13 PM | #16 |
FINALLY I got it. Thank you guys for all the help
Sorry for being so thickheaded that I didn't understand what you tried to explain earlier. |
|
ESOUI » Developer Discussions » Lua/XML Help » Converting Destinations from LAM-1.0 to LAM-2.0 |
«
Previous Thread
|
Next Thread
»
|
Thread Tools | |
Display Modes | |
|
|