Revision Difference
Global.AccessorFunc#563611
<function name="AccessorFunc" parent="Global" type="libraryfunc">
	<description>
Adds simple Get/Set accessor functions on the specified table.
Can also force the value to be set to a number, bool or string.
	</description>
	<realm>Shared and Menu</realm>
	<file line="182-L220">lua/includes/util.lua</file>
	<file line="201-L239">lua/includes/util.lua</file>
	<args>
		<arg name="tab" type="table">The table to add the accessor functions to.</arg>
		<arg name="key" type="any">The key of the table to be get/set.</arg>
		<arg name="name" type="string">The name of the functions (will be prefixed with Get and Set).</arg>
		<arg name="force" type="number" default="nil">The type the setter should force to (uses <page>Enums/FORCE</page>).</arg>
	</args>
</function>
<example>
	<description>Adds the GetFooBar and SetFooBar functions to the Player metatable and then uses them.</description>
	<code>
local meta = FindMetaTable( "Player" )
AccessorFunc( meta, "foo_bar", "FooBar", FORCE_BOOL )
meta:SetFooBar(true)
print(meta:GetFooBar())
	</code>
	<output>true</output>
</example>
 Garry's Mod
			Garry's Mod 
		 Rust
			Rust 
		 Steamworks
			Steamworks 
		 Wiki Help
			Wiki Help