-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathbufferWriteUtf8.ts
More file actions
40 lines (38 loc) · 1.04 KB
/
bufferWriteUtf8.ts
File metadata and controls
40 lines (38 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* SPDX-License-Identifier: LGPL-3.0-or-later
* Copyright © 2026 BotForge
*/
import { ArgType, NativeFunction, Return } from "../../structures"
export default new NativeFunction({
name: "$bufferWriteUtf8",
version: "1.1.0",
description: "Writes utf8 string to a buffer",
unwrap: true,
brackets: true,
args: [
{
name: "variable name",
description: "The variable the buffer is allocated on",
type: ArgType.String,
required: true,
rest: false
},
{
name: "index",
description: "The index to start writing on",
required: true,
type: ArgType.Number,
rest: false
},
{
name: "text",
description: "The text to write",
type: ArgType.String,
rest: false,
required: true
}
],
execute(ctx, [ name, index, str ]) {
return this.success(void ctx.getEnvironmentInstance(Buffer, name)?.write(str, index))
},
})