OnConsoleInput: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
(Created page with "{{Welcome| desc=This function is called when something is typed into the [[ConnectNPC |console] and enter key is pressed.| params=<syntaxhighlight lang="lua">( text )</syntaxh...")
 
No edit summary
 
Line 1: Line 1:
{{Welcome|
<poem style="border: 2px solid #d6d2c5; background-color: #f9f4e6; padding: 1em;">
desc=This function is called when something is typed into the [[ConnectNPC |console] and enter key is pressed.|
This function was added in v1.5 patch2  and will not work on previous versions.
</poem>{{Welcome|
desc=This function is called when something is typed into the [[ConnectNPC |console]] and enter key is pressed.|
params=<syntaxhighlight lang="lua">( text )</syntaxhighlight>
params=<syntaxhighlight lang="lua">( text )</syntaxhighlight>
<poem>::text: The string that was typed in the console.
<poem>::text: The string that was typed in the console.

Latest revision as of 17:25, 24 December 2022

This function was added in v1.5 patch2 and will not work on previous versions.

Description:
This function is called when something is typed into the console and enter key is pressed.


Parameters:

( text )

text: The string that was typed in the console.


Return Values:
This function does not return any specific values.


Example

function OnConsoleInput( text )
{
	try
	{
		local script = compilestring( text );
		script();
	}catch(e)
	{
		print(e);
	}
}