Thread Tools Display Modes
10-30-07, 01:09 AM   #1
Coldfury
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 18
table/for k,v pairs() question

I did a user filled table with frames names.

and i want to make it a toggle function, so when button1 is called,
for k,v in pairs(button1) do v:Hide() end.

but or because inside the table these value are strings, or because using the "v" in v:hide() dont work.

it giving me the error about trying to put a nil value to Hide().

Any help is appreciated.

Code here = http://coldfury.pastey.net/76136
  Reply With Quote
10-30-07, 03:14 AM   #2
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
You need to use getglobal to change the strings to frames sooo you have

Code:
  local frame = getglobal(v)
	          frame :Hide()
I did a similar mistake when making StatusQuo.
  Reply With Quote
11-01-07, 01:54 PM   #3
Eidolarr
An Aku'mai Servant
 
Eidolarr's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 34
Or cut out the function call and do
Code:
_G[v]:Hide()
[e] Or even above, I don't see why you need the local variable. This should work.
Code:
getglobal(v):Hide()
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » table/for k,v pairs() question


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