I am stuck trying to figure out how to get SleekFreeBagSlots to stop throwing an error when loading.
I know it is going to be something simple since I tend to look too hard for a problem.
This link http://www.pastey.net/142336 has the Lua as it last was; shelving my current changes just to see what I was doing wrong from the beginning.
Feel free to "whack" me since this is a little addon and should be a breeze. Right now I am just looking to stop this error:
1x sfbs-4.0.0.0\sfbs.lua:15: attempt to index global 'this' (a nil value)
sfbs-4.0.0.0\sfbs.lua:150: in function `OnEvent'
<string>:"*:OnEvent":1: in function <[string "*:OnEvent"]:1>
1. Your code formatting is awful. Add line breaks after every "then", "do", and "else", and before every "end", with appropriate indentation. Right now it's very inconsistent, which makes some parts of the code hard to read.
1. Replace all instances of the word "this" with the word "self".
2. Change line 13 to read:
local function RegEvents(self)
3. Change line 142 to read:
function sfbs.OnEvent(self, event)
4. Change line 148 to read:
sfbs.bag[i] = _G["sfbsBag"..i.."Text"]
5. Post your XML file; other changes are likely needed in there.
Thank you so much. (I will credit you with helping if you want.) You are correct, XML http://www.pastey.net/142337 will need fixing.
Current error:
1x sfbs-4.0.0.0\sfbs.lua:146: attempt to call global '_G' (a table value)
<string>:"*:OnEvent":1: in function <[string "*:OnEvent"]:1>
Locals:
self = sfbsFrame {
0 = <userdata>
}
event = "VARIABLES_LOADED"
---
I didn't write the code, but am going to try and clean it up some.
I knew I was missing something real simple. I just kept reading right over the GetGlobal and never changed it.
Please note the square brackets. They are not parenthesis.
sfbs.bag[i] = _G["sfbsBag"..i.."Text"]
-- is not the same as
sfbs.bag[i] = _G("sfbsBag"..i.."Text")
-- however, you can write it as
sfbs.bag[i] = _G[("sfbsBag"..i.."Text")]
--edit: or even as
sfbs.bag[i] = _G[([[sfbsBag]]..i..[[Text]])] -- /evillaugh
and for the lua file change the relevant function to
function sfbs.OnEvent(self, event, ...)
if not sfbsOPT then sfbsOPT={skipamm = true}; end
sfbs.bag = {}
for i = 0,4 do
sfbs.bag[i] = _G[("sfbsBag"..i.."Text")]
end
checkshown()
RegEvents(self)
self:UnregisterEvent("VARIABLES_LOADED")
sfbs.OnEvent = Update
end
It's more convience for me then necessary, but I like seeing at a glance how much space I have available. The downloads from the three main addon sites would indicate that a lot of people like this addon and if it is possible to save it, then I'll try (with a lot of help from my Friends).
The only other thing close I've seen are on Titan or Fubar. The other current bag addons I've seen are "one bag" types. I like the Blizz bags fine; not into a huge thing on my screen.
Anyway, what ever the issue is, it still is rearing its ugly error, though it is a bit different this time:
1x sfbs-4.0.0.0\sfbs.lua:15: attempt to index local 'self' (a nil value)
sfbs-4.0.0.0\sfbs.lua:150: in function `OnEvent'
<string>:"*:OnEvent":1: in function <[string "*:OnEvent"]:1>
Locals:
self = sfbsFrame {
0 = <userdata>
}
event = "VARIABLES_LOADED"
checkshown = <function> @ sfbs\sfbs.lua:19:
RegEvents = <function> @ sfbs\sfbs.lua:13:
Update = <function> @ sfbs\sfbs.lua:85:
---
Check my post above, specifically the lua code section.
I updated with the missing param.
Just copy-paste it and replace the function in your file again.
That appears to have done it.
Thanks to all 3 of you. I'll tag credit if any of you want, I appreciate it.
I always have problems seeing the small things, and the harder I try, the more I miss.
I know it is going to be something simple since I tend to look too hard for a problem.
This link http://www.pastey.net/142336 has the Lua as it last was; shelving my current changes just to see what I was doing wrong from the beginning.
Feel free to "whack" me since this is a little addon and should be a breeze. Right now I am just looking to stop this error:
I know "this" needs to be changed to "self", but I still get the error.
1. Replace all instances of the word "this" with the word "self".
2. Change line 13 to read:
3. Change line 142 to read:
4. Change line 148 to read:
5. Post your XML file; other changes are likely needed in there.
6. Read this: http://forums.worldofwarcraft.com/thread.html?topicId=25626580975
Current error:
I didn't write the code, but am going to try and clean it up some.
I knew I was missing something real simple. I just kept reading right over the GetGlobal and never changed it.
Please note the square brackets. They are not parenthesis.
As noted, the code is a mess, and I guess that's why I can't figure this out.
New Lua http://www.pastey.net/142339 and XML http://www.pastey.net/142337
And thanks for the help so far.
Anyway, from the xml file change the onevent code to
and for the lua file change the relevant function to Drycoded but that addon hurts my eyes.
The only other thing close I've seen are on Titan or Fubar. The other current bag addons I've seen are "one bag" types. I like the Blizz bags fine; not into a huge thing on my screen.
Anyway, what ever the issue is, it still is rearing its ugly error, though it is a bit different this time:
I updated with the missing param.
Just copy-paste it and replace the function in your file again.
Thanks to all 3 of you. I'll tag credit if any of you want, I appreciate it.
I always have problems seeing the small things, and the harder I try, the more I miss.
Meh.
Is there a simple sample somewheres I can look at to clean this one up before submitting it to the download sites?