lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, May 10, 2013 at 7:02 PM, Harley Laue <losinggeneration@gmail.com> wrote:
> [1] > math.randomseed(os.time()+assert(tonumber(tostring({}):sub(7))))

NB: that sub(7) is not portable — tostring({}) output differs between
Lua implementations. Use gsub() to filter out numerics instead. (And
even then it is a brittle hack, relying on unspecified behaviour.)

Alexander.