Garry's Mod Wiki

Player:SendLua

  Player:SendLua( string script )

Description

Executes a simple Lua string on the player.

If you need to use this function more than once consider using net library. Send net message and make the entire code you want to execute in net.Receive on client.
The string is limited to 254 bytes. Consider using the net library for more advanced server-client interaction.

Arguments

1 string script
The script to execute.

Example

Sends "Hello World" to the client's console.

Entity( 1 ):SendLua( "print( 'Hello World' )" )