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

GonStinson wrote: I supposed that what I explained was almost imposible with Lua. Other choice is using Lua by taking sentences for a template (alredy made) and use this data in the coder.

My question is if I can get this information (sensitive to changes) from another page and manipulate it in the Lua module editor. I know how to code but I ignore how to add this information into Lua.

For example: I need to use random numbers. I saw a math module with a function to generate pseudo-random numbers, but one limit is that if I use this function twice in a page, it will generate the same number. My idea is using this function in other support templates and putting the generated numbers in my principal module, as a way to get differents random numbers in that module.

Could this be done? Thank you again.

GonStinson

The code below is what I'm using successfully to generate new numbers: math.randomseed( os.time ) math.random local iRand =math.random(10)

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