Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Table Value into Called Function?

Asked by 8 years ago

I'm working with global variables to call a function that is dependent on which variables are true. The variables are manipulated with a remote script.

This is supposed to check if the global version of the value in the table is true, and if so, set currentmode equal to the value. Then take the value and call upon the function version of it.

ModeFunctions = {"Normal", "Classic"}
--colored not needed table

checked = false
while true do
    if checked == false then --Have we already done this?
        for i,v in pairs(ModeFunctions) do
            if _G[ModeFunctions[i]] == true then
                currentmode = ModeFunctions[i]
                checked = true
            else
                warn ("Mode Function not found! Assuming to be Colored...")
                currentmode = ModeFunctions[1]
                checked = true
            end
        end
    end
    currentmode() --errors

end

This is currently what I have... Any help would be greatly appreciated!

1 answer

Log in to vote
0
Answered by 8 years ago

You're attempting to call a string value. If you look, you're setting currentmode to a value from ModeFunctions, which contains only strings.

Ad

Answer this question