New Script Editor Hover Tips and User-Defined Function Documentation

I have been waiting for the user-defined function documentation for years at this point! This is going to make my modules so much easier to explain and use.

On another note, are we going to be able to include code examples and external links to documentation like the Roblox API functions have here?

9 Likes

currently throwing an attribute between the comment and a function on different lines doesn’t show the comment, other than that this is what i’ve wanted for damn near a whole year

image

image

13 Likes

Does anybody here know if comments are still included in the runtime scripts? As-in they will be included in the finalized code and/or still take up memory.

I’ve been wondering for a long time due to luau’s non-compiled nature

7 Likes

Probably true… but having the option should still be on the table - it’s common.
I’ve been trying to learn Lua/Studio scripting for the last year… and it’s not easy.
However… watching UE tutorials last week - it’s so much simpler.

If it wasn’t for the Roblox audience I want to reach - I would have switched already.
The graphics are way better - less revamps/changes - moderation isn’t an issue like on Roblox - people cheating doesn’t exist.

I like Roblox still… but trying to find the right material/tutor to learn is no easy task.
Find a script partner is even a worse attempt.

5 Likes

Luau is compiled to more efficient “bytecode” before being interpreted or sent to Clients. This involves stripping comments and most variable names, as well as optimizations. Also, did you know Native Codegen exists?

7 Likes

As someone who works both in Lua and UE Blueprints it is a lot easier to learn but the aim of Roblox and getting young developers to learn and utilise Roblox is so that there is more written programming languages programmer’s to prepare people for stuff like jobs in the real world.

Since you’re trying to learn lua I can give you some advise. I learnt both from watching videos on the diffrent functions within lua as well as reading though documentations and searching for solutions to issues using the DevForums. Over time you’ll watch yourself improve that way and something that is useful is to only learn what you truly want to make as that will also continue to motivate you to get what you want completed but also inspire you to go further while also learning the skills.

7 Likes

Yes, I know about native code, though I believe it was said it takes extra memory (or something along those lines). I often use it on server code.

Thanks for the response, I couldn’t think of anything to search that would give me any answers for this :slightly_smiling_face:

4 Likes

There’s no interface or request/response model change to this API, but you will get user-defined documentation content as part of the Response (if it exists).

It’s on the same property as our built-in documentation (ie. Response.items[n].documentation)

8 Likes

you are correct, codegen takes up a bit more memory but the current limit is 64mb; it’s more about scripts taking slightly longer to load (due to compilation) and the average function takes up to 5kb unless you’re doing a lot of math or accessing the datamodel

6 Likes

Brilliant update! I’ve been waiting for a way to have user-defined function documentation for such a long time. So many great updates lately!

6 Likes

i’ve never seen anyone use that format for comments

9 Likes

Could we get documentation annotations too on type defined functions?

EDIT: See for work around

10 Likes

Both of those types of comments, --- and --[=[]=] are used for Moonwave doc comments. The majority of open-source libraries in the Roblox Open Source Community use Moonwave for their documentation. So they are used quite often.

10 Likes

Adding onto your @vvv331 's work around.

You can format your types like this:

local ObjectObj = {}
ObjectObj.__index = ObjectObj

--destroys it, if the cosmic bit flip occurs
function ObjectObj:Destroy():nil
    return nil
end

type ObjectType = {
    Destroy: typeof(ObjectObj.Destroy)
}

function createObject():ObjectType
    return setmetatable({}, ObjectObj)
end

local obj = createObject()
obj:Destroy()
11 Likes

Nice update, keep it up
User-defined function documentation is epic

6 Likes

Finally. I have wanted this ever since I used user defined documentation on Visual Studio 2022.

7 Likes

Very nice update… but maybe add hyperlinks to functions descriptions

11 Likes

Good. Nothing to say more than that.

5 Likes

Next: can we have custom classes and properties? so when we call it in a script it will just show up in the intellisense code completer

3 Likes

Luau is derived from Lua which is prototype-based. Classes are a huge feature, and are fundamentally different to the principles of the language. Likely, asking on an unrelated announcement, not even on the Luau GitHub, won’t sway any decisions.

Metatables are the closest we’ll get to “proper” OOP (I don’t think you need some special declaration to call something object-oriented), and are also how Roblox’s own classes are represented for Luau code.

7 Likes