Player/SendLua

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Added info, format.)
(Note)
Line 1: Line 1:
 
{{Func
 
{{Func
|Name=SendLua
 
|Parent=Player
 
 
|Description=Executes a simple Lua string on the player.  
 
|Description=Executes a simple Lua string on the player.  
  
'''Note:''' The string is limited to 254 bytes. Consider using the [[Net Library Usage|net library]] for more advanced server-client interaction.
+
{{Note|The string is limited to 254 bytes. Instead of sending Lua code with this function, consider using the {{Lib|net}} for more advanced server-client interaction, see example 2 for SendLua replacement}}
 
|Realm=Server
 
|Realm=Server
 
|IsClass=Yes
 
|IsClass=Yes

Revision as of 11:34, 14 January 2020

 Player:SendLua( )

Contents

Description

Executes a simple Lua string on the player.

NOTE

The string is limited to 254 bytes. Instead of sending Lua code with this function, consider using the net library for more advanced server-client interaction, see example 2 for SendLua replacement

Arguments

string script

The script to execute.

Examples

Example

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

local pl = Entity( 1 )
pl:SendLua( "print( 'Hello World' )" )


Personal tools
Navigation