By syntax error, I mean an error that the Script Analysis can detect (lexical/parse)
Often times I will change just five characters in a script to tune a variable or to add some brief logic before re-running my game
For practical reasons, I don’t proofread this five character change or look at the Script Analysis window before hitting the button
However, there is a considerable delay (>1 sec) between when I actually click Play/Run in studio and when the game actually starts (and fails to lex/parse and actually throws the error)
So when, out of natural and practical reflex, I start the game test process and I have a syntax error, I am forced into unneeded frustration and I lose time developing
Instead, I think studio should announce a a very clean and non-intrusive but informing error explaining that there is a syntax error while at the same time forbidding the game to play/run
This would save me the frustration of losing time without having to be overcautious
I think this would only be good for loops without a wait function.
Not allowing the game to run because of a syntax error could be a problem since Roblox has a history of non-descriptive messages in Studio, example being LinkedSources being unable to be loaded or published. And it spams like 8 or 10 different messages that all say the same generic message.
I would not want this feature because of Roblox’s track record with messages. Of course it may improve in the future, but as it stands, this would fall into the same problem.
Not only that, but I don’t think locking someone out of being able to play test their game because of a syntax error would be a good thing. It’s a thing I despise in other engines.
I don’t understand
Are you saying the current Script Analysis errors are ambiguous? (this is what would be displayed in the popup)
If so, I think that they are perfectly comprehensible; could you show an example of one you would change?
I agree that many of Roblox’s error messages are obscure right now but it seems inconceivable to me how because parts of the product are bad right now, you do not support the product being improved
Also you do realize that the errors will be thrown in runtime anyways, AFTER you’ve wasted many seconds on the game initializing
This has absolutely nothing to do with yielding
If you make a script
coroutine.yield()
pcall(function()
a
end)
you will get thrown an error as soon as the game tries to parse your code (aka BEFORE your code even runs)
I’m not referring to code messages or anything like that.
I’m referring to the messages that Studio throws in your face about “Unpublished LinkedSource Changes” or “Unable to Load LinkedSource.”
Instead of it being “Unable to load linkedSource Scripts://Main” it’ll be something like “Unable to load LinkedSource” spammed a million times over. And what’s extremely aggravating is the fact it prevents you from quickly closing the error messages in the task bar. Roblox’s problem of ambiguous error message trends also pops up in the Developer Console. “Remote Event execution exhausted. Did you forgot to implement OnClient ?” with no direction towards the script.
But, back onto the original topic:
I’d much rather see that I have an error in my code at run time. Seizing play solo because of a syntax error could be annoying, seeing how Roblox has a lack of detailed messages currently.
All you have to do is unit test your scripts. If you’re worried about wasting seconds on the game having to start before running your scripts and then figuring out you have an error. Just isolate your scripts when you are testing. There’s no need to have hundreds of other systems running when you’re only testing one or two. For instance, if you disabled an intro then you won’t have to wait for it to finish. If you enabled streaming, this should also speed up the time it takes to initially start the game so that you can test.
Often you also don’t need to go into play mode to test your system. It’s all about being efficient with your unit tests. Personally I don’t think experienced programmers would run into this issue too often. And even if they did I don’t think the couple of seconds you spent testing is too bad. And if they are as I stated previously its the developers error for not unit testing.
This feels like an issue with you not checking yourself before you wreck yourself, so to speak, and not the issue with the engine. I don’t think you should expect Roblox to stop you from wasting your own time when the tools to check syntax errors already exist in Studio. It just feels lazy.
I don’t want Roblox to hold my hand and mess with my workflow.
If I’m working on new stuff or I’m mid-refactor and I need to check the behavior of something in-game, I’m not going to disable what I’m working on first. I’ll just let it error, check my thing, and end the game.
If anything there should be a type of window that will display a list of all scripts in the current place that contain errors. You could put that window docked somewhere in your IDE, and just use that as a reference instead of preventing the user from testing their game.
Do you mean that they happen outside of your control?
I’m just having trouble understanding when it would be useful to test your game when parts of it don’t work because you unintentionally broke something
Idk, do you think you could provide an example?
For example, I may insert an defunct module script to reference as source code. There may be syntactic errors in this code, but I don’t care, as it is never loaded.
Another example is having a weapon with some broken code from the toolbox, but that still functions. In this case, I’m not directly trying to add the weapon to the game, but trying to see what behavior looks like. In this case, I want Roblox studio to still run without syntax errors.
Additionally, there might be cases where I am refactoring code in Roblox Studio, and intentionally create errors in my code that let me know
If that file is accidentally loaded
What code is left to be moved over to a new system
Let me maintain syntactic highlighting while refactoring this code
Additionally, when making 5 character changes, as you described above, Roblox will actually highlight the changes if they cause an error.
While I agree that it is frustrating that the test environment launches slow (this is actually a pet peeve of mine), I think this is better solved by making it launch faster. Adding more static analysis before launch and we end up with Visual Studio.
In short: Your post addresses a real problem with Roblox. The proposed solution is not the solution that I want.
This feature request is specifically about syntax errors (by syntax I mean detected during lex/parse-time), not run-time errors
So since syntax errors are detected without the code needing to run, Roblox already detects and shows in the script analysis these specific errors which I want to disallow play/run game with a popup
if there is a syntax error the code won’t run at all, so I don’t think your weapon example really fits
I didn’t know that scripts are compiled only when they are loaded, that’s pretty interesting… I wonder why though because it seems a little inefficient
Though, in this scenario, wouldn’t it just be much more obvious to throw a runtime error: error'script shouldn\'t run!'?
Do you mean like to leave a syntax error at a position to easily ‘teleport’ to by clicking it in the script analysis?
That does sound useful, but I think this is more of a hack, and the real problem is that Roblox does not have a nicer way to do this XD
I’m not sure what you mean here, can you maybe provide a code sample?
Yeah, but it’s not fast enough for me or my reaction time is too slow; because by the time I realize I made a mistake, I already clicked run (and slowing down to accommodate some delay would decrease my expected productivity because I am more likely not to make a syntax error)
So my big issue with this feature is that I think any notification is horrible UX. When I push play, I want Roblox to launch my game, errors and all.
What if I’m a builder in team create? My scripter is half way programming a sword, but I don’t need that to test. But oh, I can’t walk around the world I’m building until the scripter resolves the programming issues. Now yes, this can be a claim against team create over this feature, but this is a valid example
Here’s another one. What if I’m a scripter and I need to remember what parts of a humanoid are available. I generally do this by launching my (broken) game. What if I can’t do that until my code is syntactically pure? How do I do that?
Here’s another one: What if I’m a new user and I don’t know what output is? I don’t know what code is. All I do is insert a free model with a broken script. I press play, and now Roblox is making me learn how to program in order to test my game? Wat. I quit Roblox development. I don’t know how to disable scripts, comment them out, delete them, et cetera. I just wanted a cool explosion.
This is why I think this is a horrible idea from a UX perspective.
To reiterate, your problem is real (launching the game is slow), but blocking gameplay is horrible from a development perspective. Let me test my game with syntax errors!
Side note
Interesting enough, and somewhat unrelated, is that it’s actually a lot more performance friendly to do it this way. Lua is designed to compile on runtime, and so lazily doing this compilation step actually helps performance. I believe Roblox sends compiled bytecode to clients though.
Your builder in team create and new user examples are really good
For the humanoid though I think you can just comment out the syntax error before checking/see in a new baseplate place
I still support this feature but I think that your examples show that it needs to be opt-in or opt-out
on the side node:
Instead of compiling on demand (and creating a bottleneck), it would be much more performant to compile when your scripts are idling
Though, AMD_chan pointed out to me that we can’t really know when it is compiled: the errors could just be hidden until the script is requested to run