W3cubDocs

/Haxe Lua

Debug

package lua

@:native("debug") Available on lua

Static methods

static debug ():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.

static gethook (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).

static getinfo (stackLevel:Int):DebugInfo

Returns a table with information about a function.

static getlocal (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.

static getmetatable (value:AnyTable):AnyTable

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

static getregistry ():AnyTable

Returns the registry table.

static getupvalue (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.

static getuservalue (val:Dynamic):Dynamic

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

static sethook (?fun:Function, ?monitor:String):Void

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

static setlocal (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.

static setmetatable (value:AnyTable, table:AnyTable):Void

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

static setupvalue (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.

static setuservalue (udata:Dynamic, val:Dynamic):Void

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

static traceback (?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.

static upvalueid (f:Function, n:Int):Dynamic

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

static upvaluejoin (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–2018 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/lua/Debug.html