Thread Tools Display Modes
12-08-09, 03:16 PM   #1
nightcracker
A Molten Giant
 
nightcracker's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 716
The snippet thread

Hi all!
Basicly the same idea as the "post your UI" thread, but this one is for snippets! And I'll start with one, you post your own!

Hide a frame forever(very well known and simple but w/e):
lua Code:
  1. local function hideframe(f)
  2.     f.Show = function() end
  3.     f:Hide()
  4. end
__________________
Three things are certain,
Death, taxes and site not found,
You, victim of one.

Last edited by nightcracker : 12-09-09 at 12:13 AM.
  Reply With Quote
12-08-09, 04:01 PM   #2
zero-kill
A Firelord
 
zero-kill's Avatar
Join Date: Aug 2009
Posts: 497
Because I'm bored and lazy!
  Reply With Quote
12-08-09, 04:13 PM   #3
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Originally Posted by nightcracker View Post
lua Code:
  1. local function hideframe(f)
  2.     f.Show = nil
  3.     f:Hide()
  4. end
That won't work. f.Show is already a nil value as they are defined in the frame's metatable. What you'll want to do is overwrite it with a dummy function or .Hide, but a dummy function is generally better as you won't run into any awkward taint issues.

That being said: http://www.wowwiki.com/User_defined_functions

wowp has already been mentioned .
__________________
「貴方は1人じゃないよ」
  Reply With Quote
12-09-09, 12:12 AM   #4
nightcracker
A Molten Giant
 
nightcracker's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 716
Originally Posted by haste View Post
That won't work. f.Show is already a nil value as they are defined in the frame's metatable. What you'll want to do is overwrite it with a dummy function or .Hide, but a dummy function is generally better as you won't run into any awkward taint issues.

That being said: http://www.wowwiki.com/User_defined_functions

wowp has already been mentioned .
WOOPS!

Did it out of me head, you are right, I meant function() end, but I accidently did it wrong
__________________
Three things are certain,
Death, taxes and site not found,
You, victim of one.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » The snippet thread


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