Posted 05 November 2012 - 09:24 AM
**RESOLVED**
So, I am writing a *fairly* complex GUI program with scrolling menu's but I am having trouble running different functions for each item.
I am trying to do it by referencing a function from a list.
Here is the code getting the error according to the in-game computer.
(Error is an "attempt to call nil" at line 205(bellow))
the typelist is here…
I should note that during debugging i have found that the "tftype" variable is correct and on the list (always "menu" when testing)
the changeMenu() function is:
(menustate is "admin")
Finally, the relevant part of mopt is:
the code compiles but does not run past when I try and switch menu's
I will try to respond to any queries or extra info needed as quickly as possible…
So, I am writing a *fairly* complex GUI program with scrolling menu's but I am having trouble running different functions for each item.
I am trying to do it by referencing a function from a list.
Here is the code getting the error according to the in-game computer.
(Error is an "attempt to call nil" at line 205(bellow))
typelist[tftype].func()
the typelist is here…
local typelist = {
["menu"] = {func = changeMenu()},
["text"] = {func = plainText()},
["special"] = {}
}
I should note that during debugging i have found that the "tftype" variable is correct and on the list (always "menu" when testing)
the changeMenu() function is:
function changeMenu()
menustate = mopt[menustate].options[select].link
end
(menustate is "admin")
Finally, the relevant part of mopt is:
local mopt = {
["admin"] = {
options = {
{display= "Pink",
link = "admin",
ftype = "menu",
colour = colours.pink} ,
{display= "Apple",
link = "test",
ftype = "menu",
colour = colours.green} ,
the code compiles but does not run past when I try and switch menu's
I will try to respond to any queries or extra info needed as quickly as possible…