Garry's Mod Wiki

Revision Difference

function#515094

Functions in lua can also be put into variables just like a number or a string can.⤶ ```⤶ ⤶ local function killAllPlayers()⤶ for k,v in pairs(player.GetAll()) do⤶ v:Kill()⤶ end⤶ end⤶ ```⤶ ⤶ ⤶ ```⤶ ⤶ killAllPlayers()⤶ ```⤶ ⤶ ⤶ They can be fed to other functions and methods, such as <page>concommand.Add</page>, also be stored in tables.