DebugLib
debug funcions in commonlib
| Title |
debug funcions in commonlib |
| Author(s) |
LiXizhi |
| Date |
2006/11/25 |
| File |
script/ide/debug.lua |
Description
debug related functions in commonlib
Sample Code
NPL.load("(gl)script/ide/commonlib.lua");
-- include commonlib to use this lib
NPL.load("(gl)script/ide/debug.lua");
Member Functions
commonlib.DumpWSResult
dump webservice result to log file, it will dump str (if not nil) followed by the msg struct content.
- param str : nil or any name
syntax
function commonlib.DumpWSResult(str)
parameters
commonlib.ShowDebugString
show debug string using a UI control on the left top of the screen. call this function with multiple keys will display string in separate lines.
- param keyname : key name
- param str : string to display
syntax
function commonlib.ShowDebugString(keyname, str)
parameters
commonlib.debugstack
[[
- param start : Number - the stack depth at which to start the stack trace (default 1 - the function calling debugstack)
- param count1 : Number - the number of functions to output at the top of the stack (default 12)
- param count2 : Number - the number of functions to output at the bottom of the stack (default 10)
- return String : - a multi-line string showing what the current call stack looks like
If there are more than count1+count2 calls in the stack, they are separated by a "..." line.
e.g. local stack = commonlib.debugstack()
]]
syntax
function commonlib.debugstack(level, count1, count2)
parameters
| level |
|
| count1 |
|
| count2 |
Number - the number of functions to output at the bottom of the stack (default 10) |
commonlib.warning
e.g. commonlib.error(table,"error:%d", no)
in most case, one can assign this function to be a member of a certain table.
syntax
function commonlib.warning(self, message, ...)
parameters
commonlib.error
e.g. commonlib.error(table,"error:%d", no)
in most case, one can assign this function to be a member of a certain table.
syntax
function commonlib.error(self, message, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
parameters
| self |
|
| message |
|
| a1 |
|
| a2 |
|
| a3 |
|
| a4 |
|
| a5 |
|
| a6 |
|
| a7 |
|
| a8 |
|
| a9 |
|
| a10 |
|
| a11 |
|
| a12 |
|
| a13 |
|
| a14 |
|
| a15 |
|
| a16 |
|
| a17 |
|
| a18 |
|
| a19 |
|
| a20 |
|
commonlib.assert
e.g. commonlib.assert(table, cond==1, "error:%d", no)
in most case, one can assign this function to be a member of a certain table.
syntax
function commonlib.assert(self, condition, message, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
parameters
| self |
|
| condition |
|
| message |
|
| a1 |
|
| a2 |
|
| a3 |
|
| a4 |
|
| a5 |
|
| a6 |
|
| a7 |
|
| a8 |
|
| a9 |
|
| a10 |
|
| a11 |
|
| a12 |
|
| a13 |
|
| a14 |
|
| a15 |
|
| a16 |
|
| a17 |
|
| a18 |
|
| a19 |
|
| a20 |
|