Skip to content

Commit

Permalink
get_buffer/set_buffer to get/set
Browse files Browse the repository at this point in the history
  • Loading branch information
bigfarts committed Apr 25, 2023
1 parent fe2658c commit cb9f289
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,20 +228,20 @@ Sets the bytes starting at `i` to the bytes in `s`.

If `i + #s` is greater than the length of the buffer, an error will be raised.

### `Buffer:get_buffer`
### `Buffer:get`

```lua
Buffer:get_buffer(i: integer, n: integer): Buffer
Buffer:get(i: integer, n: integer): Buffer
```

Gets the bytes at [`i`, `n`) as a buffer.

If `i + n` is greater than the length of the buffer, an error will be raised.

### `Buffer:set_buffer`
### `Buffer:set`

```lua
Buffer:set_buffer(i: integer, buf: Buffer)
Buffer:set(i: integer, buf: Buffer)
```

Sets the bytes starting at `i` to the bytes in `buf`.
Expand Down
4 changes: 2 additions & 2 deletions chaudloader/src/mods/lua/lib/chaudloader/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ impl mlua::UserData for Buffer {
Ok(())
});

methods.add_method("get_bytearray", |_, this, (i, n): (usize, usize)| {
methods.add_method("get", |_, this, (i, n): (usize, usize)| {
Ok(this.0[i..i + n].to_vec())
});

methods.add_method_mut(
"set_bytearray",
"set",
|_, this, (i, buf): (usize, mlua::UserDataRef<Buffer>)| {
let slice = this
.0
Expand Down

0 comments on commit cb9f289

Please sign in to comment.