Posted 08 January 2013 - 01:45 PM
I am trying to rewrite my SmartPaste program to make a Firewolf Edition, and maybe update my original program. Unfortunately, I have run into a slight snag. I want to have my menu options carry individual functions. What I mean is when I call to buttons[2].action, I want it to use the function I specify in the table buttons. I tried using
buttons = {
{name = not logged and "Login" or "Welcome!",
color = colors.black,
BGcolor = login and colors.red or colors.lightGray,
x1 = 1,
x2 = 5,
y = 2},
{name = fWolf and "Home" or "",
color = colors.black,
BGcolor = colors.lightGray,
action = redirect("smartpaste.com/home") --tried, but it just keeps running this function.
x1 = 21,
x2 = 25,
y = 2},
{name = "New",
color = colors.black,
BGcolor = new and colors.red or colors.lightGray,
x1 = 28,
x2 = 32,
y = 2},
{name = "Download",
color = colors.black,
BGcolor = download and colors.red or colors.lightGray,
x1 = 34,
x2 = 43,
y = 2},
{name = "Help",
color = colors.black,
BGcolor = help and colors.red or colors.lightGray,
x1 = 45,
x2 = 50,
y = 2},
{name = "X",
color = colors.white,
BGcolor = colors.red,
x1 = 51,
x2 = 51,
y = 1}
}
But it would just run the function that I specify. I want it to run the function ONLY when I call back to that table index. How would I do that? I already have the rest of the code working okay, and can call to other variables.