G.select

From GMod Wiki

Jump to: navigation, search
Function
Syntax select( Integer I , ... arguments )
Where is this used?
Description:
Selects specific arguments from a vararg.
Returns: All arguments given with an index after the value of 'I'.
Part of Library: Global Functions
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=G.select]G.select [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionRuns a given function with the given arguments.
Used onNewerShared.png
Code
function dosomething(...)
   local f = select(1,...)
   if _G[f] then
       _G[f](select(2,...))
   end
end
dosomething("print","RIP","Billy","Maes")
OutputRIP Billy Maes


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox