# HG changeset patch # User Nobuyasu Oshiro # Date 1359704749 -32400 # Node ID e12fbdb2eac26338a11e64849fd46b501d938c7a # Parent 73146cb10aa5f3a5f2ca9693da8f7f203ca7913b modified readLuaScript.c requireLib.lua diff -r 73146cb10aa5 -r e12fbdb2eac2 c/readLuaScript.c --- a/c/readLuaScript.c Fri Feb 01 03:07:15 2013 +0900 +++ b/c/readLuaScript.c Fri Feb 01 16:45:49 2013 +0900 @@ -49,6 +49,7 @@ int funcC(lua_State *L) { + printf("call funcC\n"); return 0; } @@ -77,15 +78,20 @@ return -1; } printStack(L); - /* get return value */ int add_res = (int)lua_tonumber(L, 1); printf("add(2,3) = %d\n",add_res); - /* remove stack data */ int num = lua_gettop(L); lua_pop(L, num); + printStack(L); + lua_getglobal(L,"callCFunction"); + if (lua_pcall(L, 0, 0, 0)) { + printf("%s\n",lua_tostring(L, lua_gettop(L))); + lua_close(L); + return -1; + } + lua_pop(L, num); lua_close(L); - return 0; }