this wiki
Contents |
Introduction
Edit
Print is one of the basic functions of ROBLOX scripting, it is a very simple method with a single parameter. The method shows in the ROBLOX Studio's output box whatever string is entered in the parameters, or if there is a polynomial within the parameters, whatever the polynomial equals. For example,
print("Hello world!")
Would show in the output:
Hello world!
Strings vs. Polynomials
Edit
If you want to output exactly what is typed within your parameter, you enter the text within double quotes within the parentheses, however if you are trying to make RBLX.lua calculate a polynomial, then do not use double quotes, and simply enter your polynomial in the parentheses. As an example:
print("1+1")
--Double quotes cause the entered text to be outputted as-is
Would output:
1+1
But
print(1+1) --No quotes tells the engine that there is a calculation to be performed
Would output:
2
Use of Variables
Edit
Variables can also be inputted into the parameters, for example:
a = "Hello World!" print(a)
Would output:
Hello World!
Note that the quotes rule still applies as before, so
a = 1+1 print(a)
Would output:
2
In addition...
a = 1 print(5+a)
Would output:
6
Usage
Edit
As the print command does not actually interact with the ROBLOX Workspace, scripters only use this command to check if and when a certain action in their script has been performed, and, if one of the actions failed, which action in the script failed.