Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/qtlua.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Bottou <leon@bottou.org>2013-11-18 01:19:06 +0400
committerLeon Bottou <leon@bottou.org>2013-11-18 02:04:04 +0400
commit65cf3ef76008ff9c3dc0de8f90e25560663dc133 (patch)
tree11849941e699928eef2c49441bd54cf5f15e6acb
parentba4bb32aaf1ab40d4d8c03267bf40493f0c84120 (diff)
completion works with torch superclasses
-rw-r--r--qtlua/qtluautils.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/qtlua/qtluautils.cpp b/qtlua/qtluautils.cpp
index 4930f86..f19f206 100644
--- a/qtlua/qtluautils.cpp
+++ b/qtlua/qtluautils.cpp
@@ -206,7 +206,7 @@ luaQ_complete(struct lua_State *L)
if (key && keylen > 0 && keylen >= stemlen)
if (!strncmp(key, stem, stemlen))
ok = true;
- if (ok && !isalpha(key[0]))
+ if (ok && stemlen==0 && !isalpha(key[0]))
ok = false;
if (ok)
for (int i=0; ok && i<(int)keylen; i++)
@@ -255,6 +255,12 @@ luaQ_complete(struct lua_State *L)
lua_replace(L, -2);
lua_pushliteral(L, "__index");
lua_rawget(L, -2);
+ if (lua_isfunction(L, -1))
+ {
+ lua_pop(L, 1);
+ lua_pushliteral(L, "__metatable");
+ lua_rawget(L, -2);
+ }
lua_replace(L, -2);
if (! lua_istable(L, -1))
break;