Heya!
Just a bit of a FYI, this might be long post, I'm really new when it comes to LUA.
After a little absence from WoW I'm back , and I got the idea to create my own layout for my AddOn comp which is currently using oUF_Phanx. (
http://www.wowinterface.com/download...-oUFPhanx.html)
Been trying to put something really simple togheter first, but so far no luck at all. Or the lack of skills might be the correct word.
All I've managed to get working is this:
Lua Code:
local _, ns = ...
local _, playerClass = UnitClass("player")
local colors = oUF.colors
local config
ns.frames, ns.headers, ns.objects, ns.fontstrings, ns.statusbars = {}, {}, {}, {}, {}
-- Frames
local function Spawn(frame, unit, isSingle)
frame:SetPoint("CENTER", UIParent)
frame:SetSize(100, 25)
local bg = frame:CreateTexture(nil, "BACKGROUND")
bg:SetAllPoints(true)
bg:SetTexture(0, 0, 0, 0.5)
frame.bg = bg
local name = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
name:SetPoint("BOTTOM", frame, "TOP")
self:Tag(name, "[name]")
frame.Name = name
end
It does not do a whole lot more than a small black box in the middle of the screen (Thats what it's supposed to do).
And it throws a LUA error which has caused me to scratch my head a whole lot. Line 27 is "self:Tag(name, "[name]").
Lua Code:
Message: Interface\AddOns\oUF_Kygo\Frames.lua:27: attempt to index global 'self' (a nil value)
Time: 07/07/14 22:15:18
Count: 1
Stack: Interface\AddOns\oUF_Kygo\Frames.lua:27: in function `styleFunc'
Interface\AddOns\oUF\ouf.lua:262: in function <Interface\AddOns\oUF\ouf.lua:192>
(tail call): ?
Interface\AddOns\oUF\ouf.lua:552: in function `Spawn'
Interface\AddOns\oUF_Kygo\Frames.lua:63: in main chunk
Locals: frame = oUF_KygoPlayer {
0 = <userdata>
bg = <unnamed> {
}
style = "Kygo"
UNIT_EXITED_VEHICLE = <function> defined @Interface\AddOns\oUF\ouf.lua:38
UNIT_ENTERED_VEHICLE = <function> defined @Interface\AddOns\oUF\ouf.lua:38
PLAYER_ENTERING_WORLD = <function> defined @Interface\AddOns\oUF\ouf.lua:149
__elements = <table> {
}
unit = "player"
}
unit = "player"
isSingle = true
bg = <unnamed> {
0 = <userdata>
}
name = <unnamed> {
0 = <userdata>
}
(*temporary) = nil
(*temporary) = nil
(*temporary) = "BOTTOM"
(*temporary) = oUF_KygoPlayer {
0 = <userdata>
bg = <unnamed> {
}
style = "Kygo"
UNIT_EXITED_VEHICLE = <function> defined @Interface\AddOns\oUF\ouf.lua:38
UNIT_ENTERED_VEHICLE = <function> defined @Interface\AddOns\oUF\ouf.lua:38
PLAYER_ENTERING_WORLD = <function> defined @Interface\AddOns\oUF\ouf.lua:149
__elements = <table> {
}
unit = "player"
}
(*temporary) = "TOP"
(*temporary) = "attempt to index global 'self' (a nil value)"
Been trying to use diffrent variants of Healthbar and powerbar code snippets (Everything from Zork's oUF_Simple to oUF_Phanx) but when I start WoW back up with the new code in place , it's only showing the standard Blizzard UnitFrames.
The code I've been trying to make it work is this:
Lua Code:
-- Health bar
local Health = CreateFrame("FRAME", nil, self)
Health:SetHeight(14)
-- Health:SetStatusBarTexture(_TEXTURE)
Health:SetPoint("TOP", 0, -8)
Health:SetPoint("LEFT", 8, 0)
Health:SetPoint('RIGHT', -90, 0)
Health.frequentUpdates = true
Health.colorDisconnected = true
Health.colorTapping = true
Health.colorSmooth = true
Health.PostUpdate = PostUpdateHealth
self.Health = health
local HealthPoints = Health:CreateFontString(nil, "OVERLAY", "GameFontNormal")
HealthPoints:SetPoint("LEFT", Health, "RIGHT", 2, -1)
HealthPoints:SetPoint("RIGHT", self, -6, -1)
HealthPoints:SetJustifyH"CENTER"
HealthPoints:SetFont(GameFontNormal:GetFont(), 10)
HealthPoints:SetTextColor(1, 1, 1)
self:Tag(HealthPoints, '[dead][offline][classic:health]')
Health.value = HealthPoints
If this code is out of date or just plain wrong, no need to sugar coat it!