tables and string.find help
hey guys,
Im messing around with tables for a new feature mostly to understand these better and I hit a wall. I keep getting nil as a returned value and I cant see why. Code:
function MyAddon.FakeFunction() |
Quote:
|
nope doesnt work either... I've even put a chat output inside the:
Code:
for skillName, skillID in ipairs(championSkills) do OR... theres something wrong with how im calling the function with: Code:
local swapSkill = MyAddon.FindChampionSwapSkill() |
makes no sense to me.. HELLO outputs fine everytime.. HELLO 2 not even once ever. I even tried reversing the names and ID's like this.
Code:
function MyAddon.FindChampionSwapSkill() |
Ipairs does not work with non indexed, non gap table keys like strings are!
Use pairs Ipairs only works if table is an array like key 1,2,3,4,...without any gap in between |
Yeh I think Ive figure that out.
Now im trying to use string.find to find "Someplace" in example("Someplace 88"). and then later to find the "88" and save the 88 to a variable. * just realized you said use pairs.. ill try it |
Quote:
|
yw.
btw, why don't you use the IDs of the champion skills instead of the names? Again this will be complicating everything if you try to search and compare strings with multi language games. You really should rethink your learning curve and check if there are IDs (numbers) to use instead of strings. Once you learned that you never will fallback to strings anymore, and it will be less complicative ;) |
YA i do agree with you but I dont feel im ready yet to even consider other languages etc. Thats going to be my final thing down the road.
|
All times are GMT -6. The time now is 12:27 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI