-3
local data={}


eventNewPlayer=function(n)
    data[n]={tab="none"}
end

function eventChatCommand(n,c)
    if c == "foo" then

        data[n].tab = c

        if data[n].tab == c then

            ui.removeTextArea(90,n)
        else

            ui.addTextArea(90,"f"..string.rep("o",35),n,400,200,nil,nil)
        end
    end
end

table.foreach(tfm.get.room.playerList,eventNewPlayer)

It's a logical error the textarea does not appear whatsoever and I don't really see any error in the code mentioned above

1 Answers1

0

When data[n].tab = c is executed, you are assigning the value of c to data[n].tab. This will happen every time that c == "foo".

Therefore, when you execute this:

    if data[n].tab == c then

        ui.removeTextArea(90,n)
    else

        ui.addTextArea(90,"f"..string.rep("o",35),n,400,200,nil,nil)
    end

It will always execute the first part, and not the second part.

Thomas
  • 130
  • 4