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
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!
i’ve never seen anyone use that format for comments
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.
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()
Nice update, keep it up
User-defined function documentation is epic
Finally. I have wanted this ever since I used user defined documentation on Visual Studio 2022.
Good. Nothing to say more than that.
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
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.
local t = {}
function t.new()
return setmetatable({
value = 1
}, t)
end
type t = typeof(t.new())
function t.print(self: t, n: number)
pairs("something")
end
t: --> no print??
at the end of this snippet, you can see it doesn’t show the print method, could this specific case be added considering OOP is used alot in luau? we need a way to access the object entries within it’s methods without having to type the whole thing out.
the approach I showed in the snippet above is how I usually allow autocomplete to work, without it the autocomplete doesn’t work within the object methods.
this is not a niche case.
I was about to make this post myself! I personally spend a lot of my time using Java and JavaDocs and these tags are extremely useful as a developer, especially when reading third-party packages (in roblox’s case modules). After this update I’ve gone through some of my own code and started adding function documentation and I’ve found it a bit difficult to explain the purpose of certain parameters without having the documentation look weird.
If we could add comments like these per-variable this would be even more of a game-changer!
Like others have suggested, if we could go as far as LuaDocs like @permanent_fixture had mentioned, the possibilities for user-made documentations would be extreme.
Although there are many things which I want in the future, this itself is already a huge update that I’m very grateful for. Much apprecated!
i was wondering why the tooltip looked a little different, the users-defined function documentation is a absolute game-changer for me! thanks for the great update roblox
Its nice to finally have a feature to document functions, this will help me and my studio to drastically improve code readability
One of the best roblox studio updates this year!
I have a feature request it would be very neat to be able to actually have code examples in the mini documentation.
It would also be nice to add links so people can go to your documentation site with more information on it.
Like this:
YES!!!
I wish this to be a feature as well, the only problem i see is if there will be moderation for links in the documentation.
Which could be a problem, but still should be added!!!
Thanks ROBLOX for this awesome update!!!