ScriptDocumentクラス
ひとことで言うと
ScriptDocumentは、ロブロックス(Roblox)のクラスです。くわしい日本語解説は準備中のため、下に公式の説明(英語)を載せています。
公式の説明(英語):Represents the ephemeral state of an open document in the Studio Script Editor, providing APIs for reading and editing code.
クラスの関係
メソッド(21)
| 名前と書き方 | 説明 |
|---|---|
AddReadOnlyReasonsAsyncScriptDocument:AddReadOnlyReasonsAsync(reasons: Array): () | Adds reasons for the Script Editor UI to be read-only. Yields the current thread until the editor acknowledges the change. |
CloseAsyncScriptDocument:CloseAsync(): Tuple | Requests that the editor associated with this document close. Yields the current thread until the editor responds to the request. |
EditTextAsyncScriptDocument:EditTextAsync(newText: string, startLine: int, startCharacter: int, endLine: int, endCharacter: int): Tuple | Replaces the text in the specified range from (startLine, startColumn) to (endLine, endColumn) with newText. |
ForceSetSelectionAsyncScriptDocument:ForceSetSelectionAsync(cursorLine: int, cursorCharacter: int, anchorLine: int?, anchorCharacter: int?): Tuple | Asks the editor to set its cursor selection to the argument values. |
GetLineScriptDocument:GetLine(lineIndex: int?): string | Returns the text of the specified line. When no argument is provided, returns the line of the current cursor position. |
GetLineCountScriptDocument:GetLineCount(): int | Returns the number of lines in the document. |
GetReadOnlyReasonsScriptDocument:GetReadOnlyReasons(): List<string> | Returns the reasons the Script Editor UI is currently read-only. |
GetScriptScriptDocument:GetScript(): LuaSourceContainer | Returns the underlying LuaSourceContainer instance, if one exists, otherwise nil. |
GetSelectedTextScriptDocument:GetSelectedText(): string | Gets the text selected in the editor, or an empty string if there is no selection. |
GetSelectionScriptDocument:GetSelection(): Tuple | Returns the last known selection of the Script Editor in the format: CursorLine, CursorChar, AnchorLine, AnchorChar. If the Script Editor has no selection, CursorLine == AnchorLine and CursorChar == AnchorChar. |
GetSelectionEndScriptDocument:GetSelectionEnd(): Tuple | Gets the larger of the cursor position and anchor. If the editor has no selection, they are the same value. |
GetSelectionStartScriptDocument:GetSelectionStart(): Tuple | Gets the smaller of the cursor position and anchor. If the editor has no selection, they are the same value. |
GetTextScriptDocument:GetText(startLine: int?, startCharacter: int?, endLine: int?, endCharacter: int?): string | Returns text from the open editor. |
GetViewportScriptDocument:GetViewport(): Tuple | Returns the currently displayed line numbers in the editor change. |
HasSelectedTextScriptDocument:HasSelectedText(): boolean | Returns whether or not the editor has any text selected. |
IsCommandBarScriptDocument:IsCommandBar(): boolean | Returns true if the ScriptDocument represents the Command bar. |
IsReadOnlyScriptDocument:IsReadOnly(): boolean | Returns true if the Script Editor UI is currently read-only. |
MultiEditTextAsyncScriptDocument:MultiEditTextAsync(edits: Array): Tuple | Applies a batch of text edits to the document as a single atomic operation. Yields the current thread until the editor responds. |
RemoveReadOnlyReasonsAsyncScriptDocument:RemoveReadOnlyReasonsAsync(reasons: Array): () | Removes reasons for the Script Editor UI to be read-only. Yields the current thread until the editor acknowledges the change. |
RequestSetSelectionAsyncScriptDocument:RequestSetSelectionAsync(cursorLine: int, cursorCharacter: int, anchorLine: int?, anchorCharacter: int?): Tuple | Asks the editor to set its cursor selection to the argument values. |
ReviewableTextEditsAsyncScriptDocument:ReviewableTextEditsAsync(changes: Array): Tuple | Applies a batch of line-based text edits that appear in the editor as reviewable inline diffs, allowing users to accept or reject each change. |
イベント(2)
| 名前と書き方 | 説明 |
|---|---|
SelectionChangedScriptDocument.SelectionChanged(positionLine: int64, positionCharacter: int64, anchorLine: int64, anchorCharacter: int64) | Fires when the ScriptDocument changes, including immediately after a text change. |
ViewportChangedScriptDocument.ViewportChanged(startLine: int64, endLine: int64) | Fires when the displayed line numbers in the editor change. |
受け継いでいるメンバー
Instance から受け継いでいるもの(46)
Archivable・Capabilities・IsInSandbox・Name・Parent・PredictionMode・Sandboxed・AddTag・ClearAllChildren・Clone・Destroy・FindFirstAncestor・FindFirstAncestorOfClass・FindFirstAncestorWhichIsA・FindFirstChild・FindFirstChildOfClass・FindFirstChildWhichIsA・FindFirstDescendant・GetActor・GetAttribute・GetAttributeChangedSignal・GetAttributes・GetChildren・GetDebugId・GetDescendants・GetFullName・GetStyled・GetStyledPropertyChangedSignal・GetTags・HasTag・IsAncestorOf・IsDescendantOf・IsPropertyModified・QueryDescendants・RemoveTag・ResetPropertyToDefault・SetAttribute・WaitForChild・AncestryChanged・AttributeChanged・ChildAdded・ChildRemoved・DescendantAdded・DescendantRemoving・Destroying・StyledPropertiesChanged
Object から受け継いでいるもの(4)
英語の説明とメンバーの一覧は、Roblox Creator Documentation(ScriptDocument)をもとにしています(CC BY 4.0)。日本語の解説は、このサイトで独自に書いたものです。