Garry's Mod Wiki


any jit.util.funck( function func, number index )


Gets a constant at a certain index in a function.

This function isn't officially documented on LuJIT wiki, use it at your own risk.
Numbers constants goes from 0 (included) to n-1, n being the value of nconsts in jit.util.funcinfo in other words, the consts goes from (nconsts-1) to -n
This function only works for Lua defined functions.


1 function func
Function to get constant from
2 number index
Constant index (counting down from the top of the function at -1)


1 any
The constant found.

This will return a proto for functions that are created inside the target function - see Example 2.


This code demonstrates how to get a constant in a function.

function bob() print("hi") end print(jit.util.funck(bob, -1)) print(jit.util.funck(bob, -2))
Output: print<br> hi


Demonstrates how a function created inside of the accessed function will be a protos when used with this function.

local function foo() local function bar() end end print( type( jit.util.funck( foo, -1 ) ) )
Output: proto

Page Links

Special Pages



Render Time: 35ms

Session 0
DB GetPage 3
Generate Html 9
SaveChanges 8
Render Body 0
Render Sidebar 6