Exemplo n.º 1
0
LIST *
builtin_luafile(
		PARSE	*parse,
		LOL		*args,
		int		*jmp)
{
    int top;
    int ret;
    LIST *l2;
    int index = 0;

    LIST *l = lol_get(args, 0);
    if (!l) {
	printf("jam: No argument passed to LuaFile\n");
	exit(EXITBAD);
    }
    ls_lua_init();
    top = ls_lua_gettop(L);
    ls_lua_newtable(L);
    for (l2 = lol_get(args, 1); l2; l2 = l2->next) {
	ls_lua_pushstring(L, l2->string);
	ls_lua_rawseti(L, -2, ++index);
    }
    ls_lua_setfield(L, LUA_GLOBALSINDEX, "arg");
    ret = ls_luaL_loadfile(L, l->string);
    return ls_lua_callhelper(top, ret);
}
Exemplo n.º 2
0
LIST *
builtin_luafile(
        PARSE    *parse,
        LOL        *args,
        int        *jmp)
{
    int top;
    int ret;
    LISTITEM *l2;
    int index = 0;

    LIST *l = lol_get(args, 0);
    if (!list_first(l)) {
        printf("jam: No argument passed to LuaFile\n");
        exit(EXITBAD);
    }
    ls_lua_init();
    top = ls_lua_gettop(L);
    ls_lua_newtable(L);
    for (l2 = list_first(lol_get(args, 1)); l2; l2 = list_next(l2)) {
        ls_lua_pushstring(L, list_value(l2));
        ls_lua_rawseti(L, -2, ++index);
    }
    ls_lua_setglobal(L, "arg");
    ret = ls_luaL_loadfile(L, list_value(list_first(l)));
    return ls_lua_callhelper(top, ret);
}