summaryrefslogtreecommitdiff
path: root/src/ldebug.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-05 12:41:42 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-05 13:29:41 +1000
commit0299958592ed34cbd6e8cf01891fc5bbaee71750 (patch)
tree9af94dd1a097c1003107c9767b08016dae5feca5 /src/ldebug.js
parent0c48b50fc0f9f447153e2bdb935fb940ca18a745 (diff)
downloadfengari-0299958592ed34cbd6e8cf01891fc5bbaee71750.tar.gz
fengari-0299958592ed34cbd6e8cf01891fc5bbaee71750.tar.bz2
fengari-0299958592ed34cbd6e8cf01891fc5bbaee71750.zip
src/ldebug.js: If no local is found then you can't get its name
Diffstat (limited to 'src/ldebug.js')
-rw-r--r--src/ldebug.js9
1 files changed, 6 insertions, 3 deletions
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;