W3cubDocs

/Haxe Lua

Debug

package lua

Available on lua

Static methods

staticdebug():Void

Enters an interactive mode with the user, running each string that the user enters. Using simple commands and other debug facilities, the user can inspect global and local variables, change their values, evaluate expressions, and so on. A line containing only the word cont finishes this function, so that the caller continues its execution.

Note that commands for Debug.debug are not lexically nested within any function, and so have no direct access to local variables.

staticgethook(thread:Thread):Function

Returns the current hook settings of the thread, as three values: the current hook function, the current hook mask, and the current hook count (as set by the Debug.sethook function).

staticgetinfo(stackLevel:Int):DebugInfo

Returns a table with information about a function.

staticgetlocal(stackLevel:Int, idx:Int):Dynamic

This function returns the name and the value of the local variable with index local of the function at level level of the stack.

staticgetmetatable(value:AnyTable):AnyTable

Returns the metatable of the given value or null if it does not have a metatable.

staticgetregistry():AnyTable

Returns the registry table.

staticgetupvalue(f:Function, up:Int):Dynamic

This function returns the name and the value of the upvalue with index up of the function f. The function returns null if there is no upvalue with the given index.

staticgetuservalue(val:Dynamic):Dynamic

Returns the Lua value associated to val. If val is not a UserData, returns null.

staticsethook(?fun:Function, ?monitor:String):Void

Sets the given function as a hook. When called without arguments, Debug.sethook turns off the hook.

staticsetlocal(stackLevel:Int, varName:String, value:Dynamic):Void

This function assigns the value value to the local variable with index local of the function at level level of the stack. Call getinfo to check whether the level is valid.

staticsetmetatable(value:AnyTable, table:AnyTable):Void

Sets the metatable for the given value to the given table (can be null).

staticsetupvalue(f:Function, up:Int, val:Dynamic):Void

This function assigns the value value to the upvalue with index up of the function f. The function returns null if there is no upvalue with the given index. Otherwise, it returns the name of the upvalue.

staticsetuservalue(udata:Dynamic, val:Dynamic):Void

Sets the given value as the Lua value associated to the given udata. udata must be a full UserData.

statictraceback(?thread:Thread, ?message:String, ?level:Int):String

Returns a string with a traceback of the call stack.

Parameters:

message

(optional) is appended at the beginning of the traceback.

level

(optional) tells at which level to start the traceback. default is 1, the function calling traceback.

staticupvalueid(f:Function, n:Int):Dynamic

Returns a unique identifier (as a light userdata) for the upvalue numbered n from the given function f.

staticupvaluejoin(f1:Function, n1:Int, f2:Function, n2:Int):Void

Make the n1-th upvalue of the Lua closure f1 refer to the n2-th upvalue of the Lua closure f2.

© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/lua/Debug.html