varDump = function(...){ var args = {...}; var str = ''; var b,e = ..table.range(args); for(i=b;e){ var arg = args[i]; var t = type(arg); str = string.concat(str,"参数位置:",i,' ',"数据类型:",t,' '); if( t != type.table ){ str = string.concat(str,"变量值:",tostring(arg),' '); } else { str = string.concat(str,"变量值: {",' '); var logged = { _struct = 1 }; for k,v in ..table.eachName(arg){ logged[k] = true; str = string.concat(str,' ', k,' = ',tostring(v) ,' '); } for(i=1;#arg;1){ logged[i] = true; str = string.concat(str,' [', i,'] = ',tostring(arg[i]) ,' '); } for(k,v in arg){ if( !logged[k] ){ str = string.concat(str,' [', tostring(k),'] = ',tostring(v) ,' '); } } str = string.concat(str,'}',' '); if(#arg){ str = string.concat(str,"序列数组长度:",#arg,' '); } if(arg._struct){ try{ str = string.concat(str,L("结构体大小:"),..raw.sizeof(arg),' '); } catch(e){ str = string.concat(str,"结构体大小:未知(包含动态数组)",' '); } } } } return str }
65 queries in 3.457 seconds |