Edit the C:/program files/Microsoft Visual Studio 8/common7/packages/debugger/autoexp. dat file,
Insert the following code in the blank space above [hresult] at the end of the file to view the Lua call stack and variable information during Visual Studio debugging.
Lua_state {
Preview (
#(
"Thread Top =", [$ C. Top-$ C. Base, I]
)
)
Children (
#(
[Raw members]: [$ C,!],
Globals: [$ C. l_gt],
Registry: [$ C. l_g-> l_registry],
Stack size: [$ C. Top-$ C. Base, I],
STACK: # array (
Expr: $ C. Base [$ I],
Size: $ C. Top-$ C. Base,
Base: 1
),
Callstack size: $ E. ci-$ E. base_ci,
Callstack:
# Array (
Expr: $ E. CI [-$ I],
Size: $ E. ci-$ E. base_ci,
)
)
)
}
Node {
Preview (
# ($ C. I _key.tvk, "=", $ C. I _val)
)
Children (
#(
Key: $ C. I _key.tvk,
VAL: $ C. I _val,
# If ($ C. I _key.nk.next! = 0 )(
# (Next: $ C. I _key.nk.next)
)
)
)
}
Lua_tvalue {
Children (
# Switch ($ C. tt)
# Case 2 (; lua_tlightuserdata
PTR: # (const char *) ($ C. Value. p ))
)
# Case 5 (; lua_ttable
#(
[Raw]: [$ C,!],
Array size: $ C. Value. GC-> H. sizearray,
# Array (
Expr: $ E. value. GC-> H. retriable,
Size: $ E. value. GC-> H. retriable! = 0,
): # (Retriable: $ E ),
# Array (
Expr: $ C. Value. GC-> H. array [$ I],
Size: $ C. Value. GC-> H. sizearray,
Base: 1
),
# Array (
Expr: # ($ C. Value. GC-> H. node [$ I], 2 ),
Size: (1 <$ C. Value. GC-> H. lsizenode ),
Base: 1
): # (Hash part: $ E)
)
)
# Case 6 (; lua_tfunction
# If ($ C. Value. GC-> Cl. C. ISC )(
#(
Env: $ C. Value. GC-> Cl. C. env,
# Array (
Expr: $ E. value. GC-> Cl. C. upvalue [$ I],
Size: $ E. value. GC-> Cl. C. nupvalues,
): # (Upvalues: $ E)
)
) # Else (
# ($ C. Value. GC-> Cl. l)
)
)
# Case 7 (; lua_tuserdata
#(
# Array (
Expr: $ E. value. GC-> U. UV. retriable,
Size: $ E. value. GC-> U. UV. retriable! = 0,
): # (Retriable: $ E ),
Env: $ C. Value. GC-> U. UV. env,
PTR: # (const char *) (& $ C. Value. GC-> u) + 1 )),
Size: $ C. Value. GC-> U. UV. Len
)
)
# Case 8 (# ($ C. Value. GC-> TH); lua_tthread
)
Preview (
# Switch ($ C. tt)
# Case 0 ("nil"); lua_tnil
# Case 1 (
# If ($ C. Value. B = 0 )(
"False"
) # Else (
"True"
)
)
# Case 2 (; lua_tlightuserdata
# ($ C. Value. P, "lightuserdata "))
# Case 3 (; lua_tnumber
# ("#", $ C. Value. N ))
# Case 4 (; lua_tring
# ($ C. Value. GC-> TS ))
# Case 5 (; lua_ttable
# ("Table ")
)
; # Case 6 (# ($ C. Value. GC-> Cl); lua_tfunction
# Case 6 (; lua_tfunction
# If ($ C. Value. GC-> Cl. C. ISC )(
# ($ C. Value. GC-> Cl)
) # Else (
# ([(Const char *) (& ($ E. value. GC-> Cl. l. p-> source-> TSV) + 1), Sb], "(", * ($ E. value. GC-> Cl. l. p-> lineinfo ),")")
)
)
# Case 7 (# ($ C. Value. GC-> U); lua_tuserdata
# Case 8 (# ($ C. Value. GC-> TH); lua_tthread
# Default ("empty ")
)
)
}
Udata {
Preview (
# ("Userdata size =", $ C. UV. Len, "PTR =", # (void *) (& $ c) + 1 )))
)
}
Cclosure {
Preview (
$ C. f
)
}
Lclosure {
Preview (
# ([(Const char *) (& ($ E. p-> source-> TSV) + 1), Sb], "(", * ($ E. p-> lineinfo ),")")
)
}
Closure {
Preview (
# If ($ E. C. ISC) (# ($ e. c ))
# Else (# ($ E. value. GC-> Cl. L ))
)
}
Table {
Children (
#(
[Raw]: [$ C,!],
[Array size]: $ C. sizearray,
# Array (
Expr: $ E. retriable,
Size: $ E. retriable! = 0,
): # (Retriable: $ E ),
# Array (
Expr: $ C. array [$ I],
Size: $ C. sizearray,
Base: 1
),
# Array (
Expr: # ($ C. node [$ I], 2 ),
Size: (1 <$ C. lsizenode ),
Base: 1
): # (Key: $ E)
)
)
Preview (
# ("Table ")
)
}
Tstring {
Preview (
# ("'", [(Const char *) (& ($ E. TSV) + 1), Sb])
)
}
Callinfo {
Preview (
# ($ E. func, ",", $ E. func-> value. GC-> Cl. l. p-> lineinfo [$ E. savedpc-$ E. func-> value. GC-> Cl. l. p-> code-1])
)
}