aboutsummaryrefslogtreecommitdiff
path: root/src/lstring.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2018-01-18 07:10:05 +1100
committerdaurnimator <quae@daurnimator.com>2018-01-18 07:10:05 +1100
commit442789bad1bfaf101b5513859fffbec04aa8c153 (patch)
tree18e69a0bfdcb4eaf66650a2e098009e5e5b22cd0 /src/lstring.js
parentb6b8b1a1e76725125f74ecd90cfb0f3642671d8d (diff)
downloadfengari-442789bad1bfaf101b5513859fffbec04aa8c153.tar.gz
fengari-442789bad1bfaf101b5513859fffbec04aa8c153.tar.bz2
fengari-442789bad1bfaf101b5513859fffbec04aa8c153.zip
src/lstring.js: Use lua_assert instead of assert
Diffstat (limited to 'src/lstring.js')
-rw-r--r--src/lstring.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/lstring.js b/src/lstring.js
index d65fc6a..8a7e71b 100644
--- a/src/lstring.js
+++ b/src/lstring.js
@@ -1,8 +1,7 @@
"use strict";
-const assert = require("assert");
-
const defs = require('./defs.js');
+const { lua_assert } = require("./llimits.js");
class TString {
@@ -22,15 +21,15 @@ class TString {
}
const luaS_eqlngstr = function(a, b) {
- assert(a instanceof TString);
- assert(b instanceof TString);
+ lua_assert(a instanceof TString);
+ lua_assert(b instanceof TString);
return a == b || defs.luastring_eq(a.realstring, b.realstring);
};
/* converts strings (arrays) to a consistent map key
make sure this doesn't conflict with any of the anti-collision strategies in ltable */
const luaS_hash = function(str) {
- assert(defs.is_luastring(str));
+ lua_assert(defs.is_luastring(str));
let len = str.length;
let s = "|";
for (let i=0; i<len; i++)
@@ -39,7 +38,7 @@ const luaS_hash = function(str) {
};
const luaS_hashlongstr = function(ts) {
- assert(ts instanceof TString);
+ lua_assert(ts instanceof TString);
if(ts.hash === null) {
ts.hash = luaS_hash(ts.getstr());
}
@@ -48,7 +47,7 @@ const luaS_hashlongstr = function(ts) {
/* variant that takes ownership of array */
const luaS_bless = function(L, str) {
- assert(str instanceof Uint8Array);
+ lua_assert(str instanceof Uint8Array);
return new TString(L, str);
};