Issue with counting rows for an ingame editor

A new update is now available, introducing seasons and more!
  • Hey Red,


    I have an issue with my UI right now. I'm trying to create an in-game editor to execute Lua scripts. I'm struggling to properly implement row counters using the UILabel. The problem arises when the code reaches the editor's height; the row counter doesn't update properly because I can't determine which line the cursor is on. The API doesn't provide a method to retrieve the cursor position from the input or anything similar.


    Is there a workaround to implement the counter correctly, or could you add a method to get the current cursor position?


    The editor currently looks like this:


    As you can see in the screenshot, the first line (where the number one is displayed) isn't aligned with the corresponding code line.

    I know the code isn't implemented properly, but I'm really looking for a row counter since it helps with reading the code more easily.


    The code for the counter looks like this:



    Btw. Is there a way to add rich text?

    It would be useful to colorize individual strings so I can implement a syntax highlighter in the future.


    Thanks in advance.


  • just threw this together and didnt test it but you should get the idea.

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!