WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   CheckButton & Initialize Function...... (https://www.wowinterface.com/forums/showthread.php?t=2307)

xmlover 11-03-05 09:29 AM

CheckButton & Initialize Function......
 
once i wrote the code based on a thought

when CheckButton got checked, its value is 1
when it's uncheck . its value is 0



but i was wrong....when it's uncheck....its value is NIL......

so my Initialize Function should sth like this

Code:

UserSet = {}
function MyUI_Initialize()

        if UserSet=nil then
            ---- new user-----
        else
            ----- previous user -----
        end
end


and it's begin.......

when my default is set alll status ON

and user goes to Config Window and set all CheckButton Unchecked.....

next time when he is back.....

UserSet = nil...... ('cos all his Child is nil.....)

and he goes to Default Settings.........................

Hmmm,,,, how can I handle this.....



or....maybe I was totally wrong.....

maybe..the table is still there

with nothing but UserSet = {} .................



how i loved checked buttons.....

Iriel 11-03-05 12:45 PM

Well, you'd do something like

yourConfig.configValue = ButtonName:GetChecked() or false;

xmlover 11-03-05 11:55 PM

Quote:

Originally Posted by Iriel
Well, you'd do something like

yourConfig.configValue = ButtonName:GetChecked() or false;


wow....is this means that a nil value won't return to yourConfig.configValue ?

and

Code:

yourConfig.configValue = ButtonName:GetChecked() or 0;
is it OK?
so ButtonName:SetChecked() can use this yourConfig.configValue without a IF


All times are GMT -6. The time now is 12:05 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI