From 0299958592ed34cbd6e8cf01891fc5bbaee71750 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 5 May 2017 12:41:42 +1000 Subject: src/ldebug.js: If no local is found then you can't get its name --- src/ldebug.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/ldebug.js') diff --git a/src/ldebug.js b/src/ldebug.js index 18a36a6..ef0f719 100644 --- a/src/ldebug.js +++ b/src/ldebug.js @@ -134,10 +134,13 @@ const lua_getlocal = function(L, ar, n) { name = lfunc.luaF_getlocalname(L.stack[L.top - 1].value.p, n, 0); } else { /* active function; get information through 'ar' */ let local = findlocal(L, ar.i_ci, n); - name = local.name; - let pos = L.stack[local.pos]; - if (name) + if (local) { + name = local.name; + let pos = L.stack[local.pos]; L.stack[L.top++] = new TValue(pos.type, pos.value); + } else { + name = null; + } } swapextra(L); return name; -- cgit v1.2.3-54-g00ecf