From 48d20ce3e2b38d1da536e42f225401fc06147d2a Mon Sep 17 00:00:00 2001 From: daurnimator Date: Mon, 8 May 2017 18:16:46 +1000 Subject: src/lapi.js: Use .svalue() getter for lua_todataview --- src/lapi.js | 4 ++-- 1 file 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; }; -- cgit v1.2.3-70-g09d2