A comment is text that the Luau parser ignores at runtime.
تعليقات سطر واحد
You can define single-line comments with a double hyphen (--) anywhere outside a string. Single-line comments extend to the end of the line.
Use single line comments for in-line notes. If the comment spans multiple lines, use multiple single-line comments.
You can add and remove single-line comments in the Script Editor with the keyboard shortcut Ctrl/ (⌘/).
-- هذه الحالة مهمة جدًا لأن العالم سيتفجر إذا كانت-- مفقودة.if not foo thenstopWorldFromBlowingUp()end
تعليقات الكتلة
You can define multiline block comments with double hyphens and double brackets (--[[]]). Use block comments for documenting items:
- استخدم تعليق كتلة في أعلى الملفات لوصف غرضها.
- استخدم تعليق كتلة قبل الدوال أو الكائنات لوصف نواياها.
--[[
تقوم بإيقاف شعاع القمر الكوني على الفور.
يجب أن يتم استدعاؤها فقط خلال 15 دقيقة قبل منتصف الليل بتوقيت الجبل
أو قد يتعرض شعاع القمر الكوني للتلف.
]]
local function stopCosmicMoonRay()
end
If necessary, you can nest multiple brackets inside a block comment using the same number of equal signs in both the beginning and ending bracket:
--[=[تفاصيل عميقة حول شعاع القمر الكوني: [[[TOP SECRET]]]]=]
توجيهات التعليقات
Luau uses comments that start with ! to control features like type checking, native code generation, and linting.
--!strict--!nonstrict--!nocheck--!native--!nolint--!optimize 0|1|2
For linting, Roblox Studio enables the following subset of warning codes from the Luau linter: 1, 2, 3, 6, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28.
The --!optimize directive controls the optimization level of the Luau compiler for the script:
- 0 disables optimizations.
- 1 enables basic optimizations (default in Studio testing).
- 2 enables further optimizations (default in live games).
Exact optimizations aren't published and are subject to change. We recommend using the default values unless you have a specific reason not to.
تعليقات المهام
Roblox Studio supports special TODO comments. Studio bolds any text following TODO (until broken by a space):
-- TODO: أكمل الوظيفة أدناه بحيث تقوم فعليًا بما يوحي به اسمها.
local function stopWorldFromBlowingUp()
end
Use TODO comments to keep track of and communicate issues within your code.