table.ForceInsert

From GMod Wiki

Jump to: navigation, search
Function
Syntax table.ForceInsert( Table table, Var value )
Where is this used?
Description:
Inserts a value into a table even if it's empty or doesn't exist.
Returns: Table
Part of Library: Table
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Table.ForceInsert]Table.ForceInsert [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionActual code of the function.
Used onNewerShared.png
Code
 
 function table.ForceInsert( t, v ) 
 
 	if ( t == nil ) then t = {} end 
 
 	table.insert( t, v )
 
	return t
 
 end 
 
OutputN/A


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox