aboutsummaryrefslogtreecommitdiff
path: root/advtrains/helpers.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2018-01-07 19:00:43 +0100
committerorwell96 <orwell@bleipb.de>2018-01-07 19:00:43 +0100
commit07442cfe8ff1a23053446c18e2ada854eeed18d8 (patch)
tree61e22210d4a89d285eba63dba15e9ac7cd2c829c /advtrains/helpers.lua
parente3b70469687116437e90aedf0b0be61cf4a8dc3e (diff)
downloadadvtrains-07442cfe8ff1a23053446c18e2ada854eeed18d8.tar.gz
advtrains-07442cfe8ff1a23053446c18e2ada854eeed18d8.tar.bz2
advtrains-07442cfe8ff1a23053446c18e2ada854eeed18d8.zip
Decrease the amount of garbage saved in save files
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
+