Docs: dump & random

pull/2768/head
Frans de Jonge 7 years ago committed by Qingping Hou
parent 96d4adb34c
commit 108ed374b3

@ -1,5 +1,5 @@
--[[ --[[--
simple serialization function, won't do uservalues, functions, loops A simple serialization function which won't do uservalues, functions, or loops.
]] ]]
local isUbuntuTouch = os.getenv("UBUNTU_APPLICATION_ISOLATION") ~= nil local isUbuntuTouch = os.getenv("UBUNTU_APPLICATION_ISOLATION") ~= nil
@ -66,10 +66,12 @@ local function _serialize(what, outt, indent, max_lv, history)
end end
end end
--[[ --[[--Serializes whatever is in `data` to a string that is parseable by Lua.
Serializes whatever is in "data" to a string that is parseable by Lua
You can optionally specify a maximum recursion depth in "max_lv" You can optionally specify a maximum recursion depth in `max_lv`.
@function dump
@param data the object you want serialized (table, string, number, boolean, nil)
@param max_lv optional maximum recursion depth
--]] --]]
local function dump(data, max_lv) local function dump(data, max_lv)
local out = {} local out = {}

@ -1,15 +1,15 @@
-- A set of functions to extend math.random and math.randomseed. --- A set of functions to extend math.random and math.randomseed.
local random = {} local random = {}
-- Use current time as seed to randomlize. --- Uses current time as seed to randomize.
function random.seed() function random.seed()
math.randomseed(os.time()) math.randomseed(os.time())
end end
random.seed() random.seed()
-- Return a UUID (v4, random). --- Returns a UUID (v4, random).
function random.uuid(with_dash) function random.uuid(with_dash)
local array = {} local array = {}
for i = 1, 16 do for i = 1, 16 do

Loading…
Cancel
Save