Prechádzať zdrojové kódy

Merge branch 'master' of https://gitee.com/wangwenfan/congkong into zwc

zhanwencai 1 rok pred
rodič
commit
e186d66fd4

+ 31 - 1
script/common/Util.lua

@@ -565,4 +565,34 @@ table.shuffle = function(array)
 		array[i],array[r] = array[r],array[i]
 	end
 	return array
-end
+end
+
+local function print_lua_table(lua_table, indent)
+	indent = indent or 0
+	for k, v in pairs(lua_table) do
+		if type(k) == "string" then
+			k = string.format("%q", k)
+		end
+		local szSuffix = ""
+		if type(v) == "table" then
+			szSuffix = "{"
+		end
+		local szPrefix = string.rep("    ", indent)
+		formatting = szPrefix.."["..k.."]".." = "..szSuffix
+		if type(v) == "table" then
+			print(formatting)
+			print_lua_table(v, indent + 1)
+			print(szPrefix.."},")
+		else
+			local szValue = ""
+			if type(v) == "string" then
+				szValue = string.format("%q", v)
+			else
+				szValue = tostring(v)
+			end
+			print(formatting..szValue..",")
+		end
+	end
+end
+
+table.print_lua_table = print_lua_table

+ 1 - 0
script/module/absAct/HeroGrowUp.lua

@@ -667,6 +667,7 @@ function sendTaskQuery(human, mainType)
 		msgRet.taskReds[i] = isTaskRedByType(human, i) and 1 or 0
 	end
 	--Msg.trace(msgRet)
+	table.print_lua_table(msgRet)
 	Msg.send(msgRet, human.fd)
 end