Jump to content

random text from a table?


Stevenn

Recommended Posts

Hello.

I tried this, but did not work:

local texts = { 
  
{"firstText", 
  
[[ Title 
  
First Text 
  
]] 
}, 
  
{"secondText", 
  
[[ Title 
  
Second text 
]] 
}, 
} 
  
local randomText = math.random ( texts[index][2], texts[index][4] ) 
  
function setRandomtext () 
   guiSetText ( memo, randomText ) 
end 
setTimer ( setRandomtext, 60000, 1 ) -- the text should be updated every 60000 milli-seconds.  

Edited by Guest
Link to comment
Guest Guest4401
local texts = { 
    [[First text]], 
    [[Second text]] 
} 
  
setTimer( 
    function() 
        guiSetText(memo, texts[math.random(#texts)]) 
    end, 60000, 0 
) 

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...