A question about function arguments.

The question is simple. How do I see what arguments a function has been called with without overriding it?

If you are doing this for debugging then you could use debug.sethook, debug.getinfo and debug.getlocal (function parameters are just local values that are pushed onto the stack before a function call).

local inf = debug.getinfo(2)

if inf.func == func then -- if inf.name == "func_name" then
	for i=1, inf.nparams do
		print("param: ", debug.getlocal(2, i))

end, ā€œcā€)[/lua]
Replace func with the function you want to check the parameters of, or use the commented line and use the function name as a string.

[editline]27th May 2013[/editline]

This is assuming you can use the debug hook in garrysmod?

Ah, you made my day. I tried using debug aswell, but never knew getlocal can be used to acquire function params.

You have my gratitude.