*/}}
YimingWu 1 gadu atpakaļ
vecāks
revīzija
e3170befea
1 mainītis faili ar 10 papildinājumiem un 0 dzēšanām
  1. 10 0
      luajit.c

+ 10 - 0
luajit.c

@@ -72,6 +72,15 @@ int INV_RunCode(laOperator* a, laEvent* e){
     if(!Data.Code->Ptr) return LA_FINISHED;
     if(luaL_loadstring(L, Data.Code->Ptr)){ luaerr("luaL_loadstring() error:") };
     if(lua_pcall(L, 0, 0, 0)){ luaerr("lua_pcall() error:") };
+
+    lua_pushvalue(L,LUA_GLOBALSINDEX); //lua_pushglobaltable(L);       // Get global table
+    lua_pushnil(L);               // put a nil key on stack
+    while (lua_next(L,-2) != 0) { // key(-1) is replaced by the next key(-1) in table(-2)
+        char* name = lua_tostring(L,-2);  // Get key(-2) name
+        lua_pop(L,1);               // remove value(-1), now key on top at(-1)
+        printf("%s\n",name);
+    }
+    lua_pop(L,1);
     return LA_FINISHED;
 }
 
@@ -97,6 +106,7 @@ int main(int argc, char *argv[]){
     laWindow* w = laDesignWindow(-1,-1,600,600);
     laLayout* l = laDesignLayout(w,"My Layout");
     laCreatePanel(l->FirstBlock,"my_panel");
+    laCreatePanel(l->FirstBlock,"LAUI_input_mapper");
 
     laStartWindow(w);
     laMainLoop();