Jump to content

Some help.


hahec

Recommended Posts

local messages = { 
    "Hello World!", 
    2, 
} 
  
for index, message in ipairs(messages) do 
    if string.find(message, "World") then -- We search for the world: "World", if found we output a message. 
        outputChatBox("Found word: World") 
    else 
        outputChatBox(tostring(message)) -- Convert numbers (if found) to string. 
    end 
end 

Link to comment

We can use like this?

local myTable = { 
                  [1] = { question='What the Fuck?!', answer='This is a shit!' }, 
                  [2] = { question='What the Hell?!', answer='I know, this is a shit xd' } 
} 
  
for i, data in ipairs(myTable) do 
   if myTable[1]['question'] then -- We can use like myTable[index]['value1'] ?? 
      outputChatBox(myTable[1]['answer']) 
  end 
end 

I don't know why I need 'if myTable[1]['question'] xD It's only a example.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...