summaryrefslogtreecommitdiff
path: root/src/lutf8lib.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/lutf8lib.js')
-rw-r--r--src/lutf8lib.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lutf8lib.js b/src/lutf8lib.js
index f581a9e..4298a33 100644
--- a/src/lutf8lib.js
+++ b/src/lutf8lib.js
@@ -59,8 +59,8 @@ const utflen = function(L) {
let posi = u_posrelat(lauxlib.luaL_optinteger(L, 2, 1), len);
let posj = u_posrelat(lauxlib.luaL_optinteger(L, 3, -1), len);
- lauxlib.luaL_argcheck(L, 1 <= posi && --posi <= len, 2, lua.to_luastring("initial position out of string"));
- lauxlib.luaL_argcheck(L, --posj < len, 3, lua.to_luastring("final position out of string"));
+ lauxlib.luaL_argcheck(L, 1 <= posi && --posi <= len, 2, "initial position out of string");
+ lauxlib.luaL_argcheck(L, --posj < len, 3, "final position out of string");
while (posi <= posj) {
let dec = utf8_decode(s, posi);
@@ -78,7 +78,7 @@ const utflen = function(L) {
const pushutfchar = function(L, arg) {
let code = lauxlib.luaL_checkinteger(L, arg);
- lauxlib.luaL_argcheck(L, 0 <= code && code <= MAXUNICODE, arg, lua.to_luastring("value out of range", true));
+ lauxlib.luaL_argcheck(L, 0 <= code && code <= MAXUNICODE, arg, "value out of range");
lua.lua_pushstring(L, lua.to_luastring(String.fromCodePoint(code)));
};
@@ -111,14 +111,14 @@ const byteoffset = function(L) {
let posi = n >= 0 ? 1 : s.length + 1;
posi = u_posrelat(lauxlib.luaL_optinteger(L, 3, posi), s.length);
- lauxlib.luaL_argcheck(L, 1 <= posi && --posi <= s.length, 3, lua.to_luastring("position out of range", true));
+ lauxlib.luaL_argcheck(L, 1 <= posi && --posi <= s.length, 3, "position out of range");
if (n === 0) {
/* find beginning of current byte sequence */
while (posi > 0 && iscont(s[posi])) posi--;
} else {
if (iscont(s[posi]))
- lauxlib.luaL_error(L, lua.to_luastring("initial position is a continuation byte", true));
+ lauxlib.luaL_error(L, "initial position is a continuation byte");
if (n < 0) {
while (n < 0 && posi > 0) { /* move back */
@@ -155,19 +155,19 @@ const codepoint = function(L) {
let posi = u_posrelat(lauxlib.luaL_optinteger(L, 2, 1), s.length);
let pose = u_posrelat(lauxlib.luaL_optinteger(L, 3, posi), s.length);
- lauxlib.luaL_argcheck(L, posi >= 1, 2, lua.to_luastring("out of range", true));
- lauxlib.luaL_argcheck(L, pose <= s.length, 3, lua.to_luastring("out of range", true));
+ lauxlib.luaL_argcheck(L, posi >= 1, 2, "out of range");
+ lauxlib.luaL_argcheck(L, pose <= s.length, 3, "out of range");
if (posi > pose) return 0; /* empty interval; return no values */
if (pose - posi >= Number.MAX_SAFE_INTEGER)
- return lauxlib.luaL_error(L, lua.to_luastring("string slice too long", true));
+ return lauxlib.luaL_error(L, "string slice too long");
let n = (pose - posi) + 1;
- lauxlib.luaL_checkstack(L, n, lua.to_luastring("string slice too long", true));
+ lauxlib.luaL_checkstack(L, n, "string slice too long");
n = 0;
for (posi -= 1; posi < pose;) {
let dec = utf8_decode(s, posi);
if (dec === null)
- return lauxlib.luaL_error(L, lua.to_luastring("invalid UTF-8 code", true));
+ return lauxlib.luaL_error(L, "invalid UTF-8 code");
lua.lua_pushinteger(L, dec.code);
posi = dec.pos;
n++;