View Single Post
04-30-13, 08:40 AM   #353
maven79
A Defias Bandit
Join Date: Oct 2011
Posts: 2
Function for repeated panels

Maintenance at the moment so wanted to play with my layout a bit. Awesome addon btw.

For an example I will use a simple 1px class-colored border on the minimap:
Lua Code:
  1. lpanels:CreateLayout("Minimap_border",{
  2.     {   name="Minimap_border",parent="Minimap",strata="BACKGROUND",level=4,anchor_to="TOP",width="100%",height="100%",bg_color="CLASS",bg_alpha=1,inset=-1},
  3. }
  4. lpanels:ApplyLayout(nil,"Minimap_border")

And the same one with a black border.

Lua Code:
  1. lpanels:CreateLayout("Minimap_border",{
  2.     {   name="Minimap_border",parent="Minimap",strata="BACKGROUND",level=4,anchor_to="TOP",width="100%",height="100%",bg_color="0 0 0",bg_alpha=1,inset=-1},
  3. }
  4. lpanels:ApplyLayout(nil,"Minimap_border")

So what I would like is a means to turn those 2 simple border lines into a function so I then simply say something like border_class("somenewframe") or border_black("somenewframe") and not have to repeat all that lua for each of dozens of frames, and more importantly, just tweak one line when I want to add a shadow, or change a detail for every frame with one edit. Hope that makes sense. Could you provide any samples for making those functions within the lua file if it is possible? If the functions won't work, perhaps just some variables would work to simplify global changes to all panels? Thanks!
  Reply With Quote