diff options
author | orwell96 <mono96.mml@gmail.com> | 2017-01-08 21:10:02 +0100 |
---|---|---|
committer | orwell96 <mono96.mml@gmail.com> | 2017-01-08 21:10:02 +0100 |
commit | 0d2ec6f49a781f4539f934217ec8eb157f6a7796 (patch) | |
tree | 3bb12de6c0a9ae5f59aae409d8143219ff378c90 /advtrains/advtrains/init.lua | |
parent | eae99812e95eb74d28a9f7d3ee20f792f7eb8c9e (diff) | |
download | advtrains-0d2ec6f49a781f4539f934217ec8eb157f6a7796.tar.gz advtrains-0d2ec6f49a781f4539f934217ec8eb157f6a7796.tar.bz2 advtrains-0d2ec6f49a781f4539f934217ec8eb157f6a7796.zip |
Clean up debug message code
Diffstat (limited to 'advtrains/advtrains/init.lua')
-rw-r--r-- | advtrains/advtrains/init.lua | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/advtrains/advtrains/init.lua b/advtrains/advtrains/init.lua index ce3cc9f..03ec553 100644 --- a/advtrains/advtrains/init.lua +++ b/advtrains/advtrains/init.lua @@ -4,8 +4,38 @@ advtrains={} advtrains.modpath = minetest.get_modpath("advtrains") -atprint=function() end ---atprint=function(t, ...) minetest.log("action", table.concat({t, ...}, " ")) minetest.chat_send_all(table.concat({t, ...}, " ")) end +local function print_concat_table(a) + local str="" + local stra="" + for i=1,50 do + t=a[i] + if t==nil then + stra=stra.."nil " + else + str=str..stra + stra="" + if type(t)=="table" then + if t.x and t.y and t.z then + str=str..minetest.pos_to_string(t) + else + str=str..dump(t) + end + elseif type(t)=="boolean" then + if t then + str=str.."true" + else + str=str.."false" + end + else + str=str..t + end + str=str.." " + end + end + return str +end +--atprint=function() end +atprint=function(t, ...) minetest.log("action", "[advtrains]"..print_concat_table({t, ...})) minetest.chat_send_all("[advtrains]"..print_concat_table({t, ...})) end sid=function(id) return string.sub(id, -4) end dofile(advtrains.modpath.."/helpers.lua"); |