summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lapi.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lapi.js b/src/lapi.js
index bf62931..38c8bd7 100644
--- a/src/lapi.js
+++ b/src/lapi.js
@@ -647,8 +647,8 @@ const lua_todataview = function(L, idx) {
if (!o.ttisstring() && !o.ttisnumber())
return null;
- let dv = new DataView(new ArrayBuffer(o.value.length));
- o.value.forEach((e, i) => dv.setUint8(i, e, true));
+ let dv = new DataView(new ArrayBuffer(o.vslen()));
+ o.svalue().forEach((e, i) => dv.setUint8(i, e, true));
return dv;
};