Board Thread:Lua Help/@comment-4854677-20140908150532/@comment-24473195-20140910155852

GonStinson wrote: Dessamator wrote:

The code below is what I'm using successfully to generate new numbers:

The first math.random is necessary because for some reason it will always return the same number. I used this successfully in a template and it worked. The thing is that because of caching it takes some time to return a new random number, unless you call the template again. I guess as long as you use a parameter that changes it will always return a new value. Thank you. I am trying this code in this module. I am using it in this template, but as I reload the page, the sentence is the same.

I have not worked with random sensitive templates before, so I do not know if this could be normal. The only change I see is when editing and saving the template (or cliking "Preview").

Thak you again, greetins.

GonStinson It does change. The only problem is that wikia's caching prevents it from changing very often. So it may take something like 25 mins or so show a new random value. Basically it works the same way as http://wikimarkup.wikia.com/wiki/Option. For my purposes the time it takes to change isn't a problem, I'm not sure how to force it to trigger a change on every refresh.