CLuaParticle/SetThinkFunction

From Garry's Mod
Jump to: navigation, search
 CLuaParticle:SetThinkFunction( )

Contents

Description

Sets the think function of the particle.

Arguments

function thinkFunc

Think function. It has only one argument:

CLuaParticle particle - The particle the think hook is set on

Examples

Example

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

p:SetNextThink( 1e99 ) -- 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( 1e99 ) -- Makes sure the think hook is actually ran.
end )


Personal tools
Navigation