Garry's Mod Wiki

CLuaParticle:SetThinkFunction

  CLuaParticle:SetThinkFunction( function thinkFunc )

Description

Sets the think function of the particle.

Arguments

1 function thinkFunc
Think function.
Function argument(s):
1 CLuaParticle particle - The particle the think hook is set on

Example

Example on how to use a think function, randomizes the colors of a particle

p:SetNextThink( CurTime() ) -- Makes sure the think hook is used on all particles of the particle emitter p:SetThinkFunction( function( pa ) pa:SetColor( math.random( 0, 255 ), math.random( 0, 255 ), math.random( 0, 255 ) ) -- Randomize it pa:SetNextThink( CurTime() ) -- Makes sure the think hook is actually ran. end )