Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
3

Why does the '#' act like comments '--'?

Asked by 10 years ago

I was looking at a few scripts 'in studio', and I stumbled upon this type of code that kind of acted as a comment. But it has a red line under it, why does the # act as a comment? Here's an example of how it's used;

#script.Parent = nil --As you'll see, it's green [in studio] just like this comment turns this green
0
Are you trying to make joke? YasuYoshida 171 — 10y
2
The # symbol is mainly used to get the number of something, usually in a table. Since "script.Parent" is not a number value of some sort, it will error, which is the cause of the red line. As for the green text, I have no idea. Discern 1007 — 10y
4
I actually just tested this and it seems that # DOES turn text green when used on the very first line. On any other line, however, it works normally. I have no idea why this would be... Perci1 4988 — 10y
5
I don't really know anything about this, but here's what I know: The # symbol creates a stand-alone interpreter. If there is a # in the first line, the script ignores it. This allows the use of Lua as a script interpreter in the Unix system. I don't think you can use this in ROBLOX, and I just searched this up. You can find more here: http://www.lua.org/pil/1.4.html Discern 1007 — 10y
View all comments (2 more)
1
It seems to me that it would be some sort of preprocessor, but I can't find any documentation on such a feature. It's probably a bug in the syntax highlighter, unless it's used by the CoreScripts. adark 5487 — 10y
0
from the comments I see above, I have come to a probably very accurate conclusion: documentation was trash back in 2015 lmao. or this just became a thing. greatneil80 2647 — 3y

Answer this question