Thread Tools Display Modes
11-01-10, 08:07 AM   #1
DonCorneo
A Cyclonian
 
DonCorneo's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 47
a nil value (like must issues)

Reported by Bug Grabber:

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 = nil
checkshown = <function> @ sfbs\sfbs.lua:19:
RegEvents = <function> @ sfbs\sfbs.lua:13:
Update = <function> @ sfbs\sfbs.lua:85:

---


I have tried to make the changes from "this" to "self", but something is not right, obviously. I am still learning how all this works.
I'm not the original author, but have been handed the reins. The addon is SleekFreeBagSlots (aka sfbs and FreeBagSlots). Any help will be much appreciated. If another author wants to see what I've tried doing, PM me and let me know how to send the current .lua I'm working with.

Thank you very much!
  Reply With Quote
11-01-10, 08:43 AM   #2
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
You can paste code at www.pastebin.com or www.pastey.net for example.

But if the code used to be something like

lua Code:
  1. myframe:SetScript("OnEvent", function()
  2.     this:SetAwesomeStuff()
  3. end)

and you only changed the "this" to "self" it wont work, you also need to have it in the function call, like this (added some other stuff that would be relevant as well, such as 'event')

lua Code:
  1. myframe:SetScript("OnEvent", function(self, event)
  2.     self:SetAwesomeStuff()
  3. end)

But paste the code or no one can really help you properly.
__________________
Oh, the simulated horror!
  Reply With Quote
11-01-10, 08:45 AM   #3
Luzzifus
A Warpwood Thunder Caller
 
Luzzifus's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 94
You have to explicitly add "self" to the function header as the first parameter. Like:

lua Code:
  1. function OnEvent(self, event, ...)
  2.    -- here you can do things with self
  3. end

**edit: too late
  Reply With Quote
11-01-10, 01:14 PM   #4
DonCorneo
A Cyclonian
 
DonCorneo's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 47
Used http://www.pastey.net/142333 to post the original pre-Cataclysm .lua that was not throwing errors before 4xxx.
The addon is working still, but have to toggle "Global" off and on again to make it display, but it is not updating on its own like it should either.
Right now I just want to get it to stop throwing errors, than I'll work on the updating.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » a nil value (like must issues)

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off