Table of Contents

advtrains.random_id

Generates an unique identifier.

Note: this page has been written for Advtrains 2.0.1 TSS and Minetest 5.1.0. Examples and practices described in this page don't take advantage of improvements introduced in later releases.

Syntax

advtrains.random_id()

Extended description

Generates a random 6-digit identifier.

Parameters

*This function does not take any parameters.*

Example

-- Create a brick platform
advtrains.random_id() -- 160218
advtrains.random_id() -- 372546

In source code

advtrains/helpers.lua, lines 330 to 336:

random_id.lua
function advtrains.random_id()
    local idst=""
        for i=0,5 do
	    idst=idst..(math.random(0,9))
    end
    return idst
end