use of jit.util.funcinfo

Hi, I want to use jit.util.funcinfo in a script of mine to find people using cheats detouring debug.getinfo. I havent really used it and I don’t really understand how it’s done exactly. I see it’s used as such

jit.util.funcinfo(func, pc)

I don’t know pc, and I just wish to know how exactly it’s used, it’s args, if it’s efficient to run jit on, etc

Thanks!

http://stackoverflow.com/questions/7167566/luajit-2-optimization-guide Geoff Leyland’s reply, read that.

http://wiki.luajit.org/JIT-Compiler-API found this while looking into it

I assume jit needs to be on for this to work? jit.on()? or command parameters?

hi

Jit doesn’t need to be on to use this. I’m not sure about the second parameter, but if you feed it a function then it’ll give you back a table of information similar to debug.getinfo.



> PrintTable(jit.util.funcinfo(print))
addr	=	1773317824
ffid	=	25
upvalues	=	1

> local print = print _G.print = function(...) print(...) end

> PrintTable(jit.util.funcinfo(print))
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


you don’t need jit on to use it:



> PrintTable(jit.util.funcinfo(PS.Trading.RequestTrade))...
linedefined	=	67
currentline	=	67
params	=	3
stackslots	=	12
source	=	@addons/pointshop/lua/sv_trading.lua
lastlinedefined	=	107
children	=	false
upvalues	=	0
nconsts	=	0
isvararg	=	false
loc	=	sv_trading.lua:67
bytecodes	=	87
gcconsts	=	22


Oh, thanks guys. :slight_smile: