jit.util.funcinfo

From Garry's Mod
Jump to: navigation, search
 jit.util.funcinfo( )

Contents

Description

Retrieves LuaJIT information about a given function, similarly to debug.getinfo. Possible table fields:

  • linedefined: as for debug.getinfo
  • lastlinedefined: as for debug.getinfo
  • params: the number of parameters the function takes
  • stackslots: the number of stack slots the function's local variable use
  • upvalues: the number of upvalues the function uses
  • bytecodes: the number of bytecodes it the compiled function
  • gcconsts: the number of garbage collectable constants
  • nconsts: the number of lua_Number (double) constants
  • children: Boolean representing whether the function creates closures
  • currentline: as for debug.getinfo
  • isvararg: if the function is a vararg function
  • source: as for debug.getinfo
  • loc: a string describing the source and currentline, like "<source>:<line>"
  • ffid: the fast function id of the function (if it is one). In this case only upvalues above and addr below are valid
  • addr: the address of the function (if it is not a Lua function). If it's a C function rather than a fast function, only upvalues above is valid*

Arguments

function func

Function or Proto to retrieve info about.

Arguments

number pos=0

Returns

table

Information about the supplied function/proto.

Examples

Example

Demonstrates output of this function.

PrintTable(jit.util.funcinfo(print))

local print = print
_G.print = function(...) print(...) end -- redefine print

PrintTable(jit.util.funcinfo(print))

Output:

-- First PrintTable output:
addr	=	1773317824
ffid	=	25
upvalues	=	1

-- Second PrintTable output:
linedefined	=	1
currentline	=	1
params	=	0
stackslots	=	2
source	=	@lua_run
lastlinedefined	=	1
children	=	false
upvalues	=	1
nconsts	=	0
isvararg	=	true
loc	=	lua_run:1
bytecodes	=	5
gcconsts	=	0
Personal tools
Navigation