PDA

View Full Version : Code Check


abnrange
12-10-2008, 12:43 PM
Not sure if my code is incorrect or if there is a bug.

On Button Click
sSelectedText = TextFile.ReadToString("AutoPlay\\SoftwareDIS\\NWClient\\admin\\Unattended .txt");
Input.SetText("Input1", sSelectedText);
---hide/show buttons-----
Button.SetVisible("NWClienSave", true);
Button.SetVisible("BatSave", false);


I get the following error:
On Click line 4: attempt to index global "button' (a string value)


My Global Code
---calendar----
function SetUpTables()
tdayofweek = {};
tdayofweek[1] = "Sunday";
tdayofweek[2] = "Monday";
tdayofweek[3] = "Tuesday";
tdayofweek[4] = "Wednesday";
tdayofweek[5] = "Thursday";
tdayofweek[6] = "Friday";
tdayofweek[7] = "Saturday";
tmonth = {};
tmonth[1] = "January";
tmonth[2] = "February";
tmonth[3] = "March";
tmonth[4] = "April";
tmonth[5] = "May";
tmonth[6] = "June";
tmonth[7] = "July";
tmonth[8] = "August";
tmonth[9] = "September";
tmonth[10] = "October";
tmonth[11] = "November";
tmonth[12] = "December";
end


Not sure why setting a button to visible or hidden would cause this error. Thanks

Imagine Programming
12-10-2008, 01:05 PM
that could be caused because somewhere you have a variable called button that has a string in it

abnrange
12-10-2008, 01:41 PM
Your are correct. Don't know how I missed that. Thanks