Garry's Mod Wiki

debug.setupvalue

  string debug.setupvalue( function func, number index, any val = nil )

Description

This function was removed due to security concerns.

Sets the variable indexed from func

Arguments

1 function func
The function to index the upvalue from
2 number index
The index from func
3 any val = nil
The value to set the upvalue to.

Returns

1 string
Returns nil if there is no upvalue with the given index, otherwise it returns the upvalue's name.

Example

An example demonstrating a function overwrite.

local function my_isfunction(f) return type(f) == "function" or f == "coolguy" end print(debug.setupvalue(hook.Add, 1, my_isfunction))