Thread Tools Display Modes
Prev Previous Post   Next Post Next
08-27-09, 09:05 AM   #1
rossman
A Cyclonian
 
rossman's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 39
help getting info panel plugin to work

I am trying to learn how to do some very basic lua coding. I successfully got one plugin to work(Anymeter= I am still testing it but it seems to work good).

I copied and modified a layout.lua file for my LDB display. It shows my info blocks and does not have any errors. If I create a frame like this.

local cp = CreateFrame("Frame","cp_frame")
cp:SetFrameStrata("BACKGROUND")
cp:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 0)
cp:SetWidth(900)
cp:SetHeight(15)
cp:SetScale(1.2)
cp:SetBackdropColor(0, 0, 0)
cp:SetClampedToScreen(true)
cp:EnableMouse(true)
cp:Show()

Now the problem. When I modify my nUI InfoPanel Plugin.lua code to try and re parent the frame to the info panel it gives an error. Attempt to index global cp_frame (a nil value). Both lua files run fron the same folder\TOC

layout.lua
plugin.lua

My plugin.lua relevent sections

plugin.setEnabled = function( enabled )

if plugin.enabled ~= enabled then

plugin.enabled = enabled;

cp_frame:ClearAllPoints ();
cp_frame:SetPoint ("TOPLEFT", plugin.container, "TOPLEFT", 0, 0);

end
end

-------------------------------------------------------------------------------

plugin.setSelected = function( selected )

if selected ~= plugin.selected then

plugin.selected = selected;

if selected then

cp_frame:Show ();

else

cp_frame:Hide ();

end

end
end

I hope I have given enough info here if not just ask. Thanks for trying to help me understand lua.
 
 

WoWInterface » Featured Projects » nUI, MozzFullWorldMap and PartySpotter » Customization » nUI: Developer Chat » help getting info panel plugin to work


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