View Single Post
01-06-19, 11:58 AM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
Rusmikey: Think of each .lua file as a function in its own right and each file is passed several (currently two paramters). The first is the name of the addon the file is in and, the second is a table that is exclusive to and available to all .lua files under the addon. The table can be used for sharing data/functions etc. between .lua files in the addon.

When you see something like local _,Core = ... (usually) near the beginning of a .lua file, that is the "file" retrieving these "parameters" (as mentioned, the _ is usualy used as a throwaway parameter)
Code:
function Code.lua(...)
     local _, Core = ...
--or 
    local addonName, Core = ...
--or
   local Addon, NS = ...
end

The UIRadioButtonTemplate doesn't do anything on it own other than just display a checkbutton that looks like a radio button. You have to add the OnClick code to de-select the other buttons when each one is clicked.

Lua Code:
  1. <CheckButton name="UIRadioButtonTemplate" virtual="true">
  2.         <Size>
  3.             <AbsDimension x="16" y="16"/>
  4.         </Size>
  5.         <Layers>
  6.             <Layer level="BACKGROUND">
  7.                 <FontString name="$parentText" inherits="GameFontNormalSmall" parentKey="text">
  8.                     <Anchors>
  9.                         <Anchor point="LEFT" relativePoint="RIGHT">
  10.                             <Offset>
  11.                                 <AbsDimension x="5" y="0"/>
  12.                             </Offset>
  13.                         </Anchor>
  14.                     </Anchors>
  15.                 </FontString>
  16.             </Layer>
  17.         </Layers>
  18.         <NormalTexture file="Interface\Buttons\UI-RadioButton">
  19.             <TexCoords left="0" right="0.25" top="0" bottom="1"/>
  20.         </NormalTexture>
  21.         <HighlightTexture file="Interface\Buttons\UI-RadioButton" alphaMode="ADD">
  22.             <TexCoords left="0.5" right="0.75" top="0" bottom="1"/>
  23.         </HighlightTexture>
  24.         <CheckedTexture file="Interface\Buttons\UI-RadioButton">
  25.             <TexCoords left="0.25" right="0.5" top="0" bottom="1"/>
  26.         </CheckedTexture>
  27. </CheckButton>
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 01-06-19 at 12:04 PM.
  Reply With Quote