limits of execution environment??
this one has me stumped; my only thought is I don't have enough resources allocated to execute this. I'm writing this lua within Gryphonheart addon, which until now has never presented problems like this.
I can't get a few strings concatenated and returned to a higher variable. I'm taking binary code and reassembling to english, so the final concatenation which won't work is located a few orders down: Code:
local sentence = "" The basic concat code works fine if I isolate it. I can print() the individual table values. So... !@?!?! I can only imagine this is too much iteration? doesn't throw a lua error, just returns an empty "sentence" variable. I tried both ".." and table.concat method. To be clear, here is the mysterious code block itself: Code:
local sentence = "" |
How long strings we talking here?
Can you post an actual example that we can try? |
Here is actually a *working* example, but notice there are 2 commented out conditional statements. With them commented, it works. With them in it doesn't. This leads me to think it may in fact be a performance issue because when I run the whole item (not copied here) with them commented out, it still doesn't run. So these 2 lines can break the item, but removing them doesn't necessarily fix it...
With the conditionals commented, this code will interpret any binary bytes it finds in the CHAT_MSG_SAY channel. Apologies for my self-taught, brute-force approach here - and thanks in advance for any time and tips you have! (note there is one conditional - GHI_CountBuffs - that requires GHI..) Code:
local word_table = {} |
Well, I can't say I understand what all this stuff is meant to accomplish, but there's no reason those conditionals would break anything, as they don't alter the process in any way.
I tried it in an offline interpreter, and as far as I can tell it will ignore words shorter than seven characters? When entering sufficiently long words, it just seemed to print a string of one � (unknown character) per word. Not sure if that's intended? And if it is, maybe that comes out as an empty string when printed in game? As for performance, well, if you're in combat there is a limit on how long a single script is allowed to run before it is terminated. Not sure what the limit is. I think a few tenths of a second. Other than that I don't believe there any restrictions. |
*EDIT* I've now got it officially working! I *think* the problem was the location of the concatenation, but I changed a lot and am not sure. You can paste this full item code into an Advanced Item > Script widget in GHI and it will work (type /binary to speak)
It allows you to both speak and understand binary. I don't think the runtime of lua was the problem, after all that. Thanks for looking it over! Code:
|
Sounds like you need to double check how your keys are defined, then. I would start there. If you use pairs it will iterate over any keys in the table, and unless you have perfectly sequenced integer keys starting at 1 the order is undefined. ipairs will only iterate over perfectly sequenced integer keys starting at 1 and do so in order, but that doesn't help if your keys are broken in the first place.
# just returns the length of a table or a string. There shouldn't be anything unintuitive about it. Although for tables it once again requires sequenced integer keys starting at 1 to give the expected result. Edit: Oh, okay. Glad to hear you got it sorted! |
All times are GMT -6. The time now is 02:23 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI