changhong/lua_probject/extend_project/extend/zipai/fanpaofa/main/test.lua

149 lines
4.1 KiB
Lua

local funcs = require("functions")
local CardCheck = require("CardCheck")
function LuaPrint(lua_table, limit, indent, step)
step = step or 0
indent = indent or 0
local content = ""
if limit ~= nil then
if step > limit then
return "..."
end
end
if step > 10 then
return content .. "..."
end
if lua_table == nil then
return "nil"
end
if type(lua_table) == "userdata" or type(lua_table) == "lightuserdata" or type(lua_table) == "thread" then
return tostring(lua_table)
end
if type(lua_table) == "string" or type(lua_table) == "number" then
return "[No-Table]:" .. lua_table
end
for k, v in pairs(lua_table) do
if k ~= "_class_type" then
local szBuffer = ""
Typev = type(v)
if Typev == "table" then
szBuffer = "{"
end
local szPrefix = string.rep(" ", indent)
if Typev == "table" and v._fields then
local kk, vv = next(v._fields)
if type(vv) == "table" then
content = content .. "\n\t" .. kk.name .. "={" .. LuaPrint(vv._fields, 5, indent + 1, step + 1) ..
"}"
else
content = content .. "\n\t" .. kk.name .. "=" .. vv
end
else
if type(k) == "table" then
if k.name then
if type(v) ~= "table" then
content = content .. "\n" .. k.name .. "=" .. v
else
content = content .. "\n" .. k.name .. " = list:"
local tmp = "\n"
for ka, va in ipairs(v) do
tmp = tmp .. "#" .. ka .. "_" .. tostring(va)
end
content = content .. tmp
end
end
elseif type(k) == "function" then
content = content .. "\n fun=function"
else
formatting = szPrefix .. tostring(k) .. " = " .. szBuffer
if Typev == "table" then
content = content .. "\n" .. formatting
content = content .. LuaPrint(v, limit, indent + 1, step + 1)
content = content .. "\n" .. szPrefix .. "},"
else
local szValue = ""
if Typev == "string" then
szValue = string.format("%q", v)
else
szValue = tostring(v)
end
content = content .. "\n" .. formatting .. (szValue or "nil") .. ","
end
end
end
end
end
return content
end
function printlog(...)
if true then
print(...)
end
end
function pt(...)
if true then
local arg = { ... }
local has = false
for _, v in pairs(arg) do
if v and type(v) == "table" then
has = true
break
end
end
if not has then
print(...)
end
local content = ""
for _, v in pairs(arg) do
if v == "table" then
content = content .. tostring(v) .. "\n"
else
content = content .. "==>[T]:" .. LuaPrint(v, limit), debug.traceback() .. "\n"
end
print(content)
end
end
end
local player = {}
local room = {}
room.game_id = 17
room.room_config = {
config = {
hunum = 0
}
}
player.hu_xi = 0
player.handcard_list ={106,107,105,109,109,205,205,205,204,204,204,108,108,108,201,201,202,207,210,209}
player.fz_list = {
--[[
{
type = 2,
active_card = 208,
opcard = {208,208},
card = 208,
},
{
type = 1,
card = 204,
opcard = {
203,
202,
},
active_card = 204,
}]]
}
CardCheck.tingPai(player,room)