local max = 32767 -- php's randmax on windows
x = math.random(0, max) .. "_this"
Note that at some earlier point (at least in pre-0.8.0 versions of love) you need to use math.randomseed() for the result to be properly random-seeming.
You create a table called 'alphabet' (guess what you'll put in it) and do something like "var = math.random(26)", then search for the var index in alphabet
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
function createUUID()
local uuid = ""
local chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
for i = 1, 30 do
local l = math.random(1, #chars)
uuid = uuid .. string.sub(chars, l, l)
end
return uuid
end
You can place whatever characters you want in that string. It basically just chooses a character at random from it. But I guess you could also use string.char() which I didn't know about until just this moment. Either way would work fine I guess. Mine would only return letters and numbers unless modified.