View Single Post
01-14-24, 05:21 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,894
Any time you see local in front of a variable name, you're creating a new variable (type to be determined on the other side of the =).

Code:
local testFrame = CreateFrame("Frame", testFrame, UIParent)
Creates a new Frame and assigns it to the testFrame variable of type table (as previously noted, frames are tables)

Lua Code:
  1. testFrame.texture = testFrame:CreateTexture()
Creates a new texture Region and assigns it the texture key of testFrame. Same as:
Lua Code:
  1. testFrame["texture"] = testFrame:CreateTexture()

But you can't add a key to a table that hasn't been created which is what
Code:
local testFrame.texture = testFrame:CreateTexture()
was trying to do (testFrame being nil at the time you get to the =).
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 01-14-24 at 05:45 PM.
  Reply With Quote