From 75dbcf913f6971f945df667366b82560e911dcc2 Mon Sep 17 00:00:00 2001 From: Anaminus Date: Fri, 8 Jul 2022 17:01:19 +0000 Subject: [PATCH] Improve description of bit32.replace. Fix description of w parameter, indicate that index is 0-based, and indicate that selected range causes an error if out of bounds. --- docs/_pages/library.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_pages/library.md b/docs/_pages/library.md index 1af997a8..6ca2c05a 100644 --- a/docs/_pages/library.md +++ b/docs/_pages/library.md @@ -701,7 +701,7 @@ Shifts `n` to the left by `i` bits (if `i` is negative, a right shift is perform function bit32.replace(n: number, r: number, f: number, w: number?): number ``` -Replaces bits at positions `[f..w]` of number `n` with `r` and returns the resulting integer. `w` defaults to `f+1`, so a three-argument version of `replace` changes one bit at position `f` to `r` (which should be 0 or 1) and returns the result. +Replaces bits of `n` at position `f` and width `w` with `r`, and returns the resulting integer. `w` defaults to `1`, so a three-argument version of `replace` changes one bit at position `f` to `r` (which should be 0 or 1) and returns the result. Bits are indexed starting at 0. Errors if `f` and `f+w-1` are not between 0 and 31. ``` function bit32.rrotate(n: number, i: number): number