G.Msg
From GMod Wiki
Function | |
Syntax |
Msg( String message ) Where is this used? |
Description: | |
This function prints text in the console. | |
Returns: | nil |
Part of Library: | Global Functions |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=G.Msg]G.Msg [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | Outputs Hello World to console. |
---|---|
Used on | |
Code | Msg("Hello World\n") |
Output | Hello World |
Description | Outputs the contents of the variable "MyString" to console. |
---|---|
Used on | |
Code | local MyString = "pie" Msg( "This is my string: " .. MyString .. "\n") |
Output | This is my string: pie |
Additional Notes
- Your message should be ended with an "\n" - for example: "Hello world!\n". Otherwise the next message that is written won't begin on the next line, it will begin at the end of your last message!
- Alternatively of appending every message with "\n" you can use MsgN instead.
- If run on the client, the message will be yellow in color. When run on the server, the message will be blue in color. For white text, use print.
- This is only visible in the console of the system it is run on - when run on the server, only the server console sees it. When run on the client, only that client sees it. If you wish to send a message to all clients, consider using MsgAll.