local m = {}function m:printTT(content,...) local tab = 0 local out_List = {} local function printk(value,key,tab) if key == nil then return end if type(key) ~= "number" then key = tostring(key) else key = string.format("[%d]",key) end if type(value) == "table" then if key ~= nil then table.insert(out_List,tab .. key .. " =") end table.insert(out_List,tab .. "{") for k,v in pairs(value) do printk(v,k,tab .. "| ") end table.insert(out_List,tab .. "},") else local content if type(value) == "nil" or value == "^&nil" then value = "nil" elseif type(value) == "string" then value = string.format("\"%s\"",tostring(value)) else value = tostring(value) end content = string.format("%s%s = %s,",tab,value) table.insert(out_List,tostring(content)) end end local value = type(content) == "string" and string.format(content,...) or content local key = os.date("[\"%X\"]",os.time()) printk(value,"") local out_str = table.concat(out_List,"\n") print(out_str .. "\n") -- local logfilename = os.date("print_tab_%Y_%m_%d.log",os.time()) -- local logfilename = "a.log" -- local file = assert(io.open(logfilename,"a+")) -- file:write(out_str .. "\n") -- file:close()end--打印用户数据function m:logUD(ud) local function tmp(MetaT,dSet) if MetaT then for _val,_val_type in pairs(MetaT) do if type(_val_type) ~= "userdata" then if not string.find(_val,"_") then table.insert(dSet,_val) end end end table.sort(dSet) dSet[tostring(MetaT)] = {} tmp(getMetatable(MetaT),dSet[tostring(MetaT)]) end end local resTb = {} tmp(getMetatable(ud),resTb) m:printTT(resTb)endreturn m
打印结果
[LUA-print] ["21:06:18"] ={| [1] = ".backup",| [2] = "create",| [3] = "createInstance",| [4] = "disableEffect",| [5] = "enableGlow",| [6] = "enableOutline",| [7] = "enableShadow",| [8] = "getautoRenderSize",| [9] = "getEffectcolor",| [10] = "getFontname",| [11] = "getFontSize",| [12] = "getLabelEffectType",| [13] = "getoutlinesize",| [14] = "getShadowBlurRadius",| [15] = "getShadowcolor",| [16] = "getShadowOffset",| [17] = "getString",| [18] = "getStringLength",| [19] = "getStringValue",| [20] = "getTextAreaSize",| [21] = "getTextcolor",| [22] = "getTextHorizontalAlignment",| [23] = "getTextVerticalAlignment",| [24] = "getType",| [25] = "init",| [26] = "isShadowEnabled",| [27] = "istouchScaleChangeEnabled",| [28] = "new",| [29] = "setFontname",| [30] = "setFontSize",| [31] = "setString",| [32] = "setText",| [33] = "setTextAreaSize",| [34] = "setTextcolor",| [35] = "setTextHorizontalAlignment",| [36] = "setTextVerticalAlignment",| [37] = "settouchScaleChangeEnabled",| table: 0x010d7ebef0 =| {| | [1] = "addClickEventListener",| | [2] = "addtouchEventListener",| | [3] = "clone",| | [4] = "create",| | [5] = "dispatchFocusEvent",| | [6] = "enableDpadNavigation",| | [7] = "findNextFocusedWidget",| | [8] = "getActionTag",| | [9] = "getBottomBoundary",| | [10] = "getBottomInParent",| | [11] = "getCallbackname",| | [12] = "getCallbackType",| | [13] = "getCurrentFocusedWidget",| | [14] = "getCustomSize",| | [15] = "getLayoutParameter",| | [16] = "getLayoutSize",| | [17] = "getleftBoundary",| | [18] = "getleftInParent",| | [19] = "getpositionPercent",| | [20] = "getpositionType",| | [21] = "getRightBoundary",| | [22] = "getRightInParent",| | [23] = "getSize",| | [24] = "getSizePercent",| | [25] = "getSizeType",| | [26] = "gettopBoundary",| | [27] = "gettopInParent",| | [28] = "gettouchBeganposition",| | [29] = "gettouchendposition",| | [30] = "gettouchmoveposition",| | [31] = "getVirtualRenderer",| | [32] = "getVirtualRendererSize",| | [33] = "getWorldposition",| | [34] = "hitTest",| | [35] = "ignoreContentAdaptWithSize",| | [36] = "intercepttouchEvent",| | [37] = "isBright",| | [38] = "isClipPingParentContainsPoint",| | [39] = "isEnabled",| | [40] = "isFlippedX",| | [41] = "isFlippedY",| | [42] = "isFocusEnabled",| | [43] = "isFocused",| | [44] = "isHighlighted",| | [45] = "isIgnoreContentAdaptWithSize",| | [46] = "isLayoutComponentEnabled",| | [47] = "isPropagatetouchEvents",| | [48] = "isSwallowtouches",| | [49] = "istouchEnabled",| | [50] = "isunifySizeEnabled",| | [51] = "new",| | [52] = "onFocusChange",| | [53] = "ontouch",| | [54] = "propagatetouchEvent",| | [55] = "requestFocus",| | [56] = "setActionTag",| | [57] = "setBright",| | [58] = "setBrightStyle",| | [59] = "setCallbackname",| | [60] = "setCallbackType",| | [61] = "setEnabled",| | [62] = "setFlippedX",| | [63] = "setFlippedY",| | [64] = "setFocusEnabled",| | [65] = "setFocused",| | [66] = "setHighlighted",| | [67] = "setLayoutComponentEnabled",| | [68] = "setLayoutParameter",| | [69] = "setpositionPercent",| | [70] = "setpositionType",| | [71] = "setPropagatetouchEvents",| | [72] = "setSize",| | [73] = "setSizePercent",| | [74] = "setSizeType",| | [75] = "setSwallowtouches",| | [76] = "settouchEnabled",| | [77] = "setunifySizeEnabled",| | [78] = "updateSizeAndposition",| | table: 0x010d7bcd18 =| | {| | | [1] = "addProtectedChild",| | | [2] = "create",| | | [3] = "disableCascadecolor",| | | [4] = "disableCascadeOpacity",| | | [5] = "getProtectedChildByTag",| | | [6] = "new",| | | [7] = "removeAllProtectedChildren",| | | [8] = "removeAllProtectedChildrenWithCleanup",| | | [9] = "removeProtectedChild",| | | [10] = "removeProtectedChildByTag",| | | [11] = "reorderProtectedChild",| | | [12] = "sortAllProtectedChildren",| | | table: 0x010d6e0db0 =| | | {| | | | [1] = "add",| | | | [2] = "addChild",| | | | [3] = "addComponent",| | | | [4] = "addTo",| | | | [5] = "align",| | | | [6] = "boundingBox",| | | | [7] = "cleanup",| | | | [8] = "convertToNodeSpace",| | | | [9] = "convertToNodeSpaceAR",| | | | [10] = "convertToWorldspace",| | | | [11] = "convertToWorldspaceAR",| | | | [12] = "converttouchToNodeSpace",| | | | [13] = "converttouchToNodeSpaceAR",| | | | [14] = "create",| | | | [15] = "disableNodeEvents",| | | | [16] = "draw",| | | | [17] = "enableNodeEvents",| | | | [18] = "enumerateChildren",| | | | [19] = "fadeIn",| | | | [20] = "fadeOut",| | | | [21] = "fadeto",| | | | [22] = "getActionByTag",| | | | [23] = "getActionManager",| | | | [24] = "getAnchorPoint",| | | | [25] = "getAnchorPointInPoints",| | | | [26] = "getBoundingBox",| | | | [27] = "getCameraMask",| | | | [28] = "getChildByname",| | | | [29] = "getChildByTag",| | | | [30] = "getChildren",| | | | [31] = "getChildrenCount",| | | | [32] = "getcolor",| | | | [33] = "getComponent",| | | | [34] = "getContentSize",| | | | [35] = "getDescription",| | | | [36] = "getdisplayedcolor",| | | | [37] = "getdisplayedOpacity",| | | | [38] = "getEventdispatcher",| | | | [39] = "getGLProgram",| | | | [40] = "getGLProgramState",| | | | [41] = "getGlobalZOrder",| | | | [42] = "getLocalZOrder",| | | | [43] = "getname",| | | | [44] = "getNodetoParentAffinetransform",| | | | [45] = "getNodetoParenttransform",| | | | [46] = "getNodetoWorldAffinetransform",| | | | [47] = "getNodetoWorldtransform",| | | | [48] = "getnormalizedposition",| | | | [49] = "getNumberOfRunningActions",| | | | [50] = "getopacity",| | | | [51] = "getorderOfArrival",| | | | [52] = "getParent",| | | | [53] = "getParentToNodeAffinetransform",| | | | [54] = "getParentToNodetransform",| | | | [55] = "getPhysicsBody",| | | | [56] = "getposition",| | | | [57] = "getposition3D",| | | | [58] = "getpositionX",| | | | [59] = "getpositionY",| | | | [60] = "getpositionZ",| | | | [61] = "getRotation",| | | | [62] = "getRotation3D",| | | | [63] = "getRotationSkewX",| | | | [64] = "getRotationSkewY",| | | | [65] = "getScale",| | | | [66] = "getScaleX",| | | | [67] = "getScaleY",| | | | [68] = "getScaleZ",| | | | [69] = "getScene",| | | | [70] = "getScheduler",| | | | [71] = "getSkewX",| | | | [72] = "getSkewY",| | | | [73] = "getTag",| | | | [74] = "getVertexZ",| | | | [75] = "getWorldToNodeAffinetransform",| | | | [76] = "getWorldToNodetransform",| | | | [77] = "getZOrder",| | | | [78] = "hIDe",| | | | [79] = "ignoreAnchorPointForposition",| | | | [80] = "init",| | | | [81] = "isCascadecolorEnabled",| | | | [82] = "isCascadeOpacityEnabled",| | | | [83] = "isIgnoreAnchorPointForposition",| | | | [84] = "isOpacityModifyRGB",| | | | [85] = "isRunning",| | | | [86] = "isScheduled",| | | | [87] = "isVisible",| | | | [88] = "move",| | | | [89] = "moveBy",| | | | [90] = "moveto",| | | | [91] = "new",| | | | [92] = "numberOfRunningActions",| | | | [93] = "onCleanup",| | | | [94] = "onEnter",| | | | [95] = "onEnterTransitionFinish",| | | | [96] = "onExit",| | | | [97] = "onExitTransitionStart",| | | | [98] = "onNodeEvent",| | | | [99] = "onUpdate",| | | | [100] = "pause",| | | | [101] = "registerScriptHandler",| | | | [102] = "removeAllChildren",| | | | [103] = "removeAllComponents",| | | | [104] = "removeChild",| | | | [105] = "removeChildByname",| | | | [106] = "removeChildByTag",| | | | [107] = "removeComponent",| | | | [108] = "removeFromParent",| | | | [109] = "removeFromParentAndCleanup",| | | | [110] = "removeSelf",| | | | [111] = "reorderChild",| | | | [112] = "resume",| | | | [113] = "rotate",| | | | [114] = "rotateBy",| | | | [115] = "rotateto",| | | | [116] = "runAction",| | | | [117] = "scaleto",| | | | [118] = "scheduleUpdate",| | | | [119] = "scheduleUpdateWithPriorityLua",| | | | [120] = "setActionManager",| | | | [121] = "setAdditionaltransform",| | | | [122] = "setAnchorPoint",| | | | [123] = "setCameraMask",| | | | [124] = "setCascadecolorEnabled",| | | | [125] = "setCascadeOpacityEnabled",| | | | [126] = "setcolor",| | | | [127] = "setContentSize",| | | | [128] = "setEventdispatcher",| | | | [129] = "setGLProgram",| | | | [130] = "setGLProgramState",| | | | [131] = "setGlobalZOrder",| | | | [132] = "setLocalZOrder",| | | | [133] = "setname",| | | | [134] = "setNodetoParenttransform",| | | | [135] = "setnormalizedposition",| | | | [136] = "setonEnterCallback",| | | | [137] = "setonExitCallback",| | | | [138] = "setopacity",| | | | [139] = "setopacityModifyRGB",| | | | [140] = "setorderOfArrival",| | | | [141] = "setParent",| | | | [142] = "setPhysicsBody",| | | | [143] = "setposition",| | | | [144] = "setposition3D",| | | | [145] = "setpositionX",| | | | [146] = "setpositionY",| | | | [147] = "setpositionZ",| | | | [148] = "setRotation",| | | | [149] = "setRotation3D",| | | | [150] = "setRotationQuat",| | | | [151] = "setRotationSkewX",| | | | [152] = "setRotationSkewY",| | | | [153] = "setScale",| | | | [154] = "setScaleX",| | | | [155] = "setScaleY",| | | | [156] = "setScaleZ",| | | | [157] = "setScheduler",| | | | [158] = "setSkewX",| | | | [159] = "setSkewY",| | | | [160] = "setTag",| | | | [161] = "setUserObject",| | | | [162] = "setVertexZ",| | | | [163] = "setVisible",| | | | [164] = "setZOrder",| | | | [165] = "setonEnterTransitionDIDFinishCallback",| | | | [166] = "setonExitTransitionDIDStartCallback",| | | | [167] = "show",| | | | [168] = "sortAllChildren",| | | | [169] = "stopAction",| | | | [170] = "stopActionByTag",| | | | [171] = "stopActionsByFlags",| | | | [172] = "stopAllActions",| | | | [173] = "stopAllActionsByTag",| | | | [174] = "unregisterScriptHandler",| | | | [175] = "unscheduleUpdate",| | | | [176] = "update",| | | | [177] = "updatedisplayedcolor",| | | | [178] = "updatedisplayedOpacity",| | | | [179] = "updatetransform",| | | | [180] = "visit",| | | | table: 0x010c765d50 =| | | | {| | | | | [1] = "getReferenceCount",| | | | | [2] = "release",| | | | | [3] = "retain",| | | | | table: 0x010c76cf18 =| | | | | {| | | | | | table: 0x010c76d208 =| | | | | | {| | | | | | },| | | | | },| | | | },| | | },| | },| },},总结
以上是内存溢出为你收集整理的[cocos2dx_Lua]打印用户数据全部内容,希望文章能够帮你解决[cocos2dx_Lua]打印用户数据所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)