debug/setupvalue

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Added information to the function)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{Func
 
{{Func
|Name=setupvalue
+
|Description={{Delete|This function was removed due to security concerns.}}
|Parent=debug
+
 
|Description=Sets the variable indexed by 'up' from function 'f' to 'newValue'.
+
Sets the variable indexed from func
|Realm=Shared
+
|Realm=Shared and Menu
 
|IsClass=No
 
|IsClass=No
 
}}
 
}}
 
{{Arg
 
{{Arg
 
|type=function
 
|type=function
|name=f
+
|name=func
|desc=The function to index the upvalue from.
+
|desc=The function to index the upvalue from
 
}}
 
}}
 
{{Arg
 
{{Arg
 
|type=number
 
|type=number
|name=up
+
|name=index
|desc=The index upwards from the function f.
+
|desc=The index from func
 
}}
 
}}
 
{{Arg
 
{{Arg
 
|type=any
 
|type=any
|name=newValue
+
|name=val
 
|desc=The value to set the upvalue to.
 
|desc=The value to set the upvalue to.
 
|default=nil
 
|default=nil
Line 33: Line 33:
  
 
print(debug.setupvalue(hook.Add, 1, my_isfunction))
 
print(debug.setupvalue(hook.Add, 1, my_isfunction))
|Output=isfunction
 
 
}}
 
}}

Latest revision as of 19:18, 26 June 2017

 debug.setupvalue( )

Contents

Description

This page has been nominated for deletion.
Reason for deletion: This function was removed due to security concerns.

Sets the variable indexed from func

Arguments

function func

The function to index the upvalue from

Arguments

number index

The index from func

Arguments

any val=nil

The value to set the upvalue to.

Returns

string

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

Examples

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))


Personal tools
Navigation