How to flag incorrect code like the Script Editor?

So im making a Plugin called “Scripx”.

Is there any way to flag code that is incorrect like the Script Editor?
Example:
Skjermbilde 2020-08-05 kl. 23.10.34
The code gets a red line under it beacuse it is incorrect.
How do you do that?

I think your best bet may be to create a custom GUI designed for editing the way you want. You could then create a rectangle and position it under the incorrect part of the script.

1 Like

@HelperBot3 It is supposed to auto-flag wrong code.

1 Like

Yes, and I gave the solution for what you asked for; how to create a red line under text. The auto-flag feature would have to be programmed, and would be a pain to list all the conditions that cause a script to throw an error, so I feel the best practice might be using pcall() to see if the code already written throws an error or not.

How do i use pcall()? (30 char)

1 Like

It is located on this page. Here’s a snapshot.
pcall

Here is some additional code to help explain how to use pcall.

local errorCall = pcall(function () error("Error!") end)
local successCall = pcall(function () print("No error!") end)
print(errorCall, successCall)
-- Prints: false, true
1 Like

Because there isn’t enough tooling available in Roblox’s engine, you’d have to program this entire system, what I mean is that most linter engines will show

  1. the line of where the issue occurred
  2. What the issue was
  3. The starting and ending column of where is occurred
3 Likes

How could i use it to display an TextLabel with text “Error!” (inside of a widget)
when code is incorrect on a TextBox?

1 Like

I’d recommend making a new scripting support forum for making a red line under specific text, as this is getting off-topic, going from how to detect an error into a GUI tutorial

2 Likes