aboutsummaryrefslogtreecommitdiff
path: root/advtrains/helpers.lua
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains/helpers.lua')
-rw-r--r--advtrains/helpers.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/advtrains/helpers.lua b/advtrains/helpers.lua
index 3864d81..5f5521f 100644
--- a/advtrains/helpers.lua
+++ b/advtrains/helpers.lua
@@ -150,6 +150,13 @@ function advtrains.merge_tables(a, ...)
end
return new
end
+function advtrains.save_keys(tbl, keys)
+ local new={}
+ for _,key in ipairs(keys) do
+ new[key] = tbl[key]
+ end
+ return new
+end
function advtrains.yaw_from_3_positions(prev, curr, next)
local pts=minetest.pos_to_string
--atprint("p3 "..pts(prev)..pts(curr)..pts(next))
@@ -315,3 +322,11 @@ function advtrains.get_matching_conn(conn, nconns)
return connlku[nconns][conn]
end
+function advtrains.random_id()
+ local idst=""
+ for i=0,5 do
+ idst=idst..(math.random(0,9))
+ end
+ return idst
+end
+