Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int Import_lua(lua_State *l)
- {
- int argc = lua_gettop(l);
- if(argc==0) return 0;
- int retNum = 0;
- size_t i;
- char buf[256];
- for(i=1; i<=argc; ++i)
- {
- if(lua_type(l, i) == LUA_TSTRING)
- {
- char *str = lua_tostring(l, i);
- lua_createtable(l,0,1);
- int sz = snprintf(buf, sizeof(buf)-1,
- "function %s(%s)\n\ti_syscall(\"%s\",%s);\nend\n",
- str, "str", str, "str");
- /*Add to table*/
- lua_pushstring(l, str);
- luaL_loadbuffer(l, buf,sz,buf);
- lua_settable(l, -3);
- ++retNum;
- }
- }
- return retNum;
- }
- int i_syscall_lua(lua_State *l)
- {
- if(lua_type(l, 1) !=LUA_TSTRING) return 0;
- printf("i_syscall: %s\n", lua_tostring(l, 1));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment