Grr, I hate it when I miss stuff...
Getting an error that I don't know how to resolve:
lua Code:
Code:
Message: Interface\AddOns\MageTaxi\magetaxi.lua:91: attempt to index field '?' (a nil value) |
If you haven't already I would convert the _G["MageTaxi_City".. num] part out to a variable and see what that says each time and if the object of that name exists both there and in CreateGUI.
Apart from that I cannot initially see anything wrong there. Especially with the error reporting values between 1 and 7 with it being stuck at 2. So the question is to find out why MageTax_City2 isn't being created, or thinks it hasn't been created. Ah, I think I know the problem, at least based on the code there. I had the same problem in my own code recently. When you call a function at creation time that is also used later on after all items are created the chances are it is trying to access something that doesn't exist yet. Try changing the setloc function to something like this. This way if _G["MageTaxi_City2"] doesn't exist when working on _G["MageTaxi_City1"] it won't kick up a fuss. Of course this assumes you haven't pre-created the objects themselves. But then again #citylist is already of size 7 but does that mean _G["MageTaxi_City2"] exists or that there are blank entries in citylist ? Code:
local function setLoc(i) |
Edit: Oh I should've noticed that too, :D
|
Quote:
Code:
cb:SetScript("OnClick", setLoc(i)) Code:
cb:SetScript("OnClick", function() setLoc(i) end) Edit: Instead of creating a separate function for each frame's "OnClick" handler why not just do: Code:
local function setLoc(self) |
The error is in the SetScript on line 149. SetScript accepts 2 parameters, the script and the function that should be called.
Code:
cb:SetScript("OnClick", setLoc(i)) Code:
setLoc(i)(...) Code:
cb:SetScript("OnClick", function(i) setLoc(i) end) Code:
function:2FJ39(...) Code:
cb:SetScript("OnClick", setLoc) Code:
setLoc(...) Final thing, you are concatenating the i variable in your setLoc function, don't you mean this? Code:
i = i:GetName() |
Quote:
Quote:
Quote:
Still learning as I go along. :D |
Quote:
Code:
function MageTaxi:SetFaction() |
Thanks, I realized the fix last night already, but good to see it verified (and it works btw).
One thing though that I've run into that maybe someone can help me with. I have ZERO understanding of string manipulation and it has me painted into a corner atm. Code:
cityList = { |
Quote:
lua Code:
I really like that I've done my regex homework so I can solve problems like this :) |
Quote:
|
Quote:
The second argument ("([a-z]+)([A-Z][a-z]+)") looks for a lower case letter ([a-z]) followed by an uppercase letter ([A-Z]) followed by a lower case letter ([a-z]). So in the case of ThunderBluff, it would find "rBl" as the pattern. Something like LookingForGroup would find "gFo" and "rGr". It then substitutes it with the third argument ("%1 %2"). In this case, it is substituting the first letter (%1) and the second letter (%2), combined would be (%1%2) with (%1 %2); essentially adding a space inbetween them. So "rBl" becomes "r Bl" in the string, making "ThunderBluff" change to "Thunder Bluff" I hope that's easier to understand than it is to explain =/ |
Quote:
To be completely accurate, it's searching for a string of lowercase letters of length >=1 both before and after the single capital letter; but it's true that you don't really need that. Removing the + signs would make it behave exactly as described. As it is, "ThunderBluff" yields one match: "hunderBluff", which in turn matches the subpatterns as "(hunder)(Bluff)" and therefore %1 == "hunder" and %2 == "Bluff", resulting in gsub replacing all instances of "hunderBluff" with "hunder Bluff", with a final result of "Thunder Bluff" since there's only one instance of that. In any case, I think: "(%l)(%u)" would work just as well; but it doesn't really matter much. |
Quote:
|
Quote:
|
Quote:
|
Bah. You missed "greedyness" in your dictionary check. :P
|
Quote:
|
:P I'm sorry for my malformed english, only a 15 year old dutch kiddo who just learns english by browsing forums like this one. "efficienter" is the comparative of efficient(which IS a dutch word) in dutch. So I was confused. And greedyness is well..... greedyness! :P
|
Great, glad the thread has become a spelling bee. :rolleyes:
|
Quote:
And sorry Chaos, didn't mean to derail your thread somewhat :D So, hows your coding going ? ( trying to steer back on topic - rofl ). |
All times are GMT -6. The time now is 02:08 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI