-
Posted by JohnnyEmdeJensen on Fri, 03 Sep 2010 07:52:34
Hello
I am new to wow programming, but have about 3 decades inspirence in programming. I followed the bagbuddy in the 2nd edition book. I locate some paths to some graphics like: Interface\Icons\INVMiscEngGizmos_30 at the top of the .lua file. In my WoW installation the only folder in Interface is the AddOns folder. So if i set a path to Interface\Icons and the Icons folder don't exists wont I recieve an error?
When I rub the BagBuddyOnLoad() I'll get this error: Message: Interface\AddOns\BagBuddy\BagBuddy.lua:2: attempt to index local 'self' (a nil value) Time: 09/03/10 09:58:05 Count: 1 Stack: [C]: ? Interface\AddOns\BagBuddy\BagBuddy.lua:2: in function
BagBuddy_OnLoad'in main chunkfunction
RunScript' Interface\FrameXML\ChatFrame.lua:1996: in function `value' Interface\FrameXML\ChatFrame.lua:4070: in function `ChatEditParseText' Interface\FrameXML\ChatFrame.lua:3660: in function `ChatEditSendText' Interface\FrameXML\ChatFrame.lua:3698: in function `ChatEditOnEnterPressed'in function <[string "*:OnEnterPressed"]:1>Locals:
Can anyone solve this?
Kind regards Johnny E. Jensen
-
Posted by jnwhiteh on Fri, 03 Sep 2010 08:03:20
Hello
I am new to wow programming, but have about 3 decades inspirence in programming. I followed the bagbuddy in the 2nd edition book. I locate some paths to some graphics like: Interface\Icons\INVMiscEngGizmos_30 at the top of the .lua file. In my WoW installation the only folder in Interface is the AddOns folder. So if i set a path to Interface\Icons and the Icons folder don't exists wont I recieve an error?
No, these are paths that WoW is able to interpret because they are part of the resources for the game itself. They will always exist.
When I rub the BagBuddyOnLoad() I'll get this error: Message: Interface\AddOns\BagBuddy\BagBuddy.lua:2: attempt to index local 'self' (a nil value) Time: 09/03/10 09:58:05 Count: 1 Stack: [C]: ? Interface\AddOns\BagBuddy\BagBuddy.lua:2: in function `BagBuddyOnLoad' [string "BagBuddyOnLoad()"]:1: in main chunk [C]: in function `RunScript' Interface\FrameXML\ChatFrame.lua:1996: in function `value' Interface\FrameXML\ChatFrame.lua:4070: in function `ChatEditParseText' Interface\FrameXML\ChatFrame.lua:3660: in function `ChatEditSendText' Interface\FrameXML\ChatFrame.lua:3698: in function `ChatEditOnEnterPressed' [string ":OnEnterPressed"]:1: in function <[string ":OnEnterPressed"]:1>
Locals:
Can anyone solve this?
Have you compared your version of that function with the version in the back of the chapter, or the version available for download from this site? Without seeing that I can't see definitively, but it appears you are trying to call
BagBuddy_OnLoad()
manually. You can't really do that, as it would have already been called by the time WoW had loaded and added your addon.You shouldn't plan to call any of the handler functions like this, because they require specific arguments that WoW passes for us. In this case, the first argument of
BagBuddy_OnLoad
is the frame itself, which you didn't pass.Hope that helps.