Garry's Mod Wiki

Garry's Mod Wiki

  string string.JavascriptSafe( string str )


Escapes special characters for JavaScript in a string, making the string safe for inclusion in to JavaScript strings.


1 string str
The string that should be escaped.


1 string
The escaped string.


Executes JavaScript on a panel using user input safely.

local user_input = "The user's input lives in this variable" local Panel = vgui.Create( "DHTML" ) Panel:SetURL( "" ) Panel:Center() Panel:SetSize( 100, 100 ) Panel:RunJavascript( "MyJavaScriptFunction('" .. string.JavascriptSafe( user_input ) .. "')" )

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...