int doread() { register struct obj *scroll; register boolean confused = (Confusion != 0); known = FALSE; scroll = getobj(readable, "read"); /* "#-" added by GAN 10/22/86 */ if(!scroll) return(0); /* below added to allow reading of fortune cookies */ if(scroll->otyp == FORTUNE_COOKIE) { if(flags.verbose) You("break up the cookie and throw away the pieces."); outrumor(bcsign(scroll), TRUE); useup(scroll); return(1); } else if(scroll->olet != SCROLL_SYM #ifdef SPELLS && scroll->olet != SPBOOK_SYM #endif ) { pline("That is a silly thing to read."); return(0); } if(Blind) { #ifdef SPELLS if (scroll->olet == SPBOOK_SYM) { pline("Being blind, you cannot read the mystic runes."); return(0); } else #endif if (!scroll->dknown) { pline("Being blind, you cannot read the formula on the scroll."); return(0); } } #ifndef NO_SIGNAL scroll->in_use = TRUE; /* now being read */ #endif #ifdef SPELLS if(scroll->olet == SPBOOK_SYM) { if(confused) { You("cannot grasp the meaning of this tome."); useup(scroll); return(0); } else return(study_book(scroll)); } #endif if(scroll->otyp != SCR_BLANK_PAPER) { if(Blind) pline("As you pronounce the formula on it, the scroll disappears."); else pline("As you read the scroll, it disappears."); if(confused) { if (Hallucination) pline("Being so trippy, you screw up..."); else pline("Being confused, you mispronounce the magic words..."); } } if(!seffects(scroll)) { if(!objects[scroll->otyp].oc_name_known) { if(known && !confused) { makeknown(scroll->otyp); more_experienced(0,10); } else if(!objects[scroll->otyp].oc_uname) docall(scroll); } if(!(scroll->otyp == SCR_BLANK_PAPER) || confused) useup(scroll); #ifndef NO_SIGNAL else scroll->in_use = FALSE; #endif } return(1); }
static int dostring (lua_State *L, const char *s, const char *name) { int status = luaL_loadbuffer(L, s, strlen(s), name) || docall(L, 0, 1); return report(L, status); }
static int dostring (lua_State *L, const char *s, const char *name) { int status = luaL_loadbuffer(L, s, strlen(s), name); if (status == LUA_OK) status = docall(L, 0, 0); return report(L, status); }
inline Value call(Function func, const Value &arg0, const Value &arg1, const Value &arg2, const Value &arg3, const Value &arg4, const Value &arg5, const Value &arg6, const Value &arg7, const Value &arg8) { Value args[] = {arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8}; return docall(func, 9, args); }
static int dolibrary(lua_State *L, const char *name) { lua_getglobal(L, "require"); lua_pushstring(L, name); return report(L, docall(L, 1, 1)); }
inline Value call(Function func, const Value &arg0) { Value args[] = {arg0}; return docall(func, 1, args); }
inline Value call(Function func, const Value &arg0, const Value &arg1, const Value &arg2, const Value &arg3) { Value args[] = {arg0, arg1, arg2, arg3}; return docall(func, 4, args); }
static void f_Comment (void *ud, const char *data) { lxp_userdata *xpu = (lxp_userdata *)ud; if (getHandle(xpu, CommentKey) == 0) return; /* no handle */ lua_pushstring(xpu->L, data); docall(xpu, 1, 0); }
static void f_DefaultExpand (void *ud, const char *data, int len) { lxp_userdata *xpu = (lxp_userdata *)ud; if (getHandle(xpu, DefaultExpandKey) == 0) return; /* no handle */ lua_pushlstring(xpu->L, data, len); docall(xpu, 1, 0); }
static void nlua_thread(int pin, int pout, char *project, char *filename) { char cmd[4096]; int cmd_size; fprintf(stderr, "[err] Starting up Lua interpreter...\n"); fprintf(stdout, "[out] Starting up Lua interpreter...\n"); lua_State *L; L = lua_open(); if (!L) { cmd[0] = LC_ERROR; cmd_size = snprintf(cmd+1, sizeof(cmd)-2, "Unable to open lua") + 1; write(1, cmd, cmd_size); exit(0); } luaL_openlibs(L); lua_sethook(L, nlua_interpret_hook, LUA_MASKLINE, 0); /* If a filename was specified, load it in and run it */ if (project && *project) { char full_filename[2048]; if (filename && *filename) snprintf(full_filename, sizeof(full_filename)-1, "%s/%s/%s", PROJECT_DIR, project, filename); else snprintf(full_filename, sizeof(full_filename)-1, "%s/%s", PROJECT_DIR, project); if (luaL_dofile(L, full_filename)) { cmd[0] = LC_ERROR; cmd_size = snprintf(cmd+1, sizeof(cmd)-2, "Error: %s", lua_tostring(L, 1)) + 1; write(1, cmd, cmd_size); } } /* If no file was specified, enter REPL mode */ else { printf("Entering REPL mode...\n"); int status; while ((status = loadline(L)) != -1) { if (status == 0) status = docall(L, 0, 0); report(L, status); if (status == 0 && lua_gettop(L) > 0) { /* any result to print? */ lua_getglobal(L, "print"); lua_insert(L, 1); if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != 0) l_message(progname, lua_pushfstring(L, "error calling " LUA_QL("print") " (%s)", lua_tostring(L, -1))); } } lua_settop(L, 0); fputs("\n", stdout); fflush(stdout); } lua_close(L); close(pin); close(pout); exit(0); return; }
static void f_EndCdataKey (void *ud) { lxp_userdata *xpu = (lxp_userdata *)ud; if (getHandle(xpu, EndCdataKey) == 0) return; /* no handle */ docall(xpu, 0, 0); }
static int dolibrary (lua_State *L, const char *name) { lua_getfield(L, LUA_ENVIRONINDEX, "require"); lua_pushstring(L, name); return report(L, docall(L, 1, 1)); }
int dodrink() { struct obj *otmp, *objs; struct monst *mtmp; int unkn = 0, nothing = 0; otmp = getobj("!", "drink"); if (!otmp) return (0); if (!strcmp(objects[otmp->otyp].oc_descr, "smoky") && !rn2(13)) { ghost_from_bottle(); goto use_it; } switch (otmp->otyp) { case POT_RESTORE_STRENGTH: unkn++; pline("Wow! This makes you feel great!"); if (u.ustr < u.ustrmax) { u.ustr = u.ustrmax; flags.botl = 1; } break; case POT_BOOZE: unkn++; pline("Ooph! This tastes like liquid fire!"); Confusion += d(3, 8); /* the whiskey makes us feel better */ if (u.uhp < u.uhpmax) losehp(-1, "bottle of whiskey"); if (!rn2(4)) { pline("You pass out."); multi = -rnd(15); nomovemsg = "You awake with a headache."; } break; case POT_INVISIBILITY: if (Invis || See_invisible) nothing++; else { if (!Blind) pline("Gee! All of a sudden, you can't see yourself."); else pline("You feel rather airy."), unkn++; newsym(u.ux, u.uy); } Invis += rn1(15, 31); break; case POT_FRUIT_JUICE: pline("This tastes like fruit juice."); lesshungry(20); break; case POT_HEALING: pline("You begin to feel better."); flags.botl = 1; u.uhp += rnd(10); if (u.uhp > u.uhpmax) u.uhp = ++u.uhpmax; if (Blind) Blind = 1; /* see on next move */ if (Sick) Sick = 0; break; case POT_PARALYSIS: if (Levitation) pline("You are motionlessly suspended."); else pline("Your feet are frozen to the floor!"); nomul(-(rn1(10, 25))); break; case POT_MONSTER_DETECTION: if (!fmon) { strange_feeling(otmp, "You feel threatened."); return (1); } else { cls(); for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) if (mtmp->mx > 0) at(mtmp->mx, mtmp->my, mtmp->data->mlet); prme(); pline("You sense the presence of monsters."); more(); docrt(); } break; case POT_OBJECT_DETECTION: if (!fobj) { strange_feeling(otmp, "You feel a pull downward."); return (1); } else { for (objs = fobj; objs; objs = objs->nobj) if (objs->ox != u.ux || objs->oy != u.uy) goto outobjmap; pline("You sense the presence of objects close nearby."); break; outobjmap: cls(); for (objs = fobj; objs; objs = objs->nobj) at(objs->ox, objs->oy, objs->olet); prme(); pline("You sense the presence of objects."); more(); docrt(); } break; case POT_SICKNESS: pline("Yech! This stuff tastes like poison."); if (Poison_resistance) pline("(But in fact it was biologically contaminated orange juice.)"); losestr(rn1(4, 3)); losehp(rnd(10), "contaminated potion"); break; case POT_CONFUSION: if (!Confusion) pline("Huh, What? Where am I?"); else nothing++; Confusion += rn1(7, 16); break; case POT_GAIN_STRENGTH: pline("Wow do you feel strong!"); if (u.ustr >= 118) break; /* > 118 is impossible */ if (u.ustr > 17) u.ustr += rnd(118 - u.ustr); else u.ustr++; if (u.ustr > u.ustrmax) u.ustrmax = u.ustr; flags.botl = 1; break; case POT_SPEED: if (Wounded_legs) { heal_legs(); unkn++; break; } if (!(Fast & ~INTRINSIC)) pline("You are suddenly moving much faster."); else pline("Your legs get new energy."), unkn++; Fast += rn1(10, 100); break; case POT_BLINDNESS: if (!Blind) pline("A cloud of darkness falls upon you."); else nothing++; Blind += rn1(100, 250); seeoff(0); break; case POT_GAIN_LEVEL: pluslvl(); break; case POT_EXTRA_HEALING: pline("You feel much better."); flags.botl = 1; u.uhp += d(2, 20) + 1; if (u.uhp > u.uhpmax) u.uhp = (u.uhpmax += 2); if (Blind) Blind = 1; if (Sick) Sick = 0; break; case POT_LEVITATION: if (!Levitation) float_up(); else nothing++; Levitation += rnd(100); u.uprops[PROP(RIN_LEVITATION)].p_tofn = float_down; break; default: impossible("What a funny potion! (%u)", otmp->otyp); return (0); } if (nothing) { unkn++; pline("You have a peculiar feeling for a moment, then it passes."); } if (otmp->dknown && !objects[otmp->otyp].oc_name_known) { if (!unkn) { objects[otmp->otyp].oc_name_known = 1; more_experienced(0, 10); } else if (!objects[otmp->otyp].oc_uname) docall(otmp); } use_it: useup(otmp); return (1); }
bool on_event(SDL_Event *event) { switch (event->type) { case SDL_TEXTINPUT: if (current_keyhandler != LUA_NOREF) { static Uint32 lastts = 0; static char lastc = 0; if (browsers_count) { // Somehow CEF3 makes keys sometime arrive duplicated, so prevent that here if (event->text.timestamp == lastts) break; if ((event->text.timestamp - lastts < 3) && (lastc == event->text.text[0])) break; } lastts = event->text.timestamp; lastc = event->text.text[0]; lua_rawgeti(L, LUA_REGISTRYINDEX, current_keyhandler); lua_pushstring(L, "receiveKey"); lua_gettable(L, -2); lua_remove(L, -2); lua_rawgeti(L, LUA_REGISTRYINDEX, current_keyhandler); lua_pushnumber(L, 0); SDL_Keymod _pKeyState = SDL_GetModState(); lua_pushboolean(L, (_pKeyState & KMOD_CTRL) ? TRUE : FALSE); lua_pushboolean(L, (_pKeyState & KMOD_SHIFT) ? TRUE : FALSE); lua_pushboolean(L, (_pKeyState & KMOD_ALT) ? TRUE : FALSE); lua_pushboolean(L, (_pKeyState & KMOD_GUI) ? TRUE : FALSE); lua_pushstring(L, event->text.text); lua_pushboolean(L, FALSE); lua_pushnil(L); lua_pushnil(L); lua_pushnumber(L, 0); docall(L, 11, 0); } return TRUE; case SDL_KEYDOWN: case SDL_KEYUP: if (current_keyhandler != LUA_NOREF) { lua_rawgeti(L, LUA_REGISTRYINDEX, current_keyhandler); lua_pushstring(L, "receiveKey"); lua_gettable(L, -2); lua_remove(L, -2); lua_rawgeti(L, LUA_REGISTRYINDEX, current_keyhandler); lua_pushnumber(L, event->key.keysym.scancode); SDL_Keymod _pKeyState = SDL_GetModState(); lua_pushboolean(L, (_pKeyState & KMOD_CTRL) ? TRUE : FALSE); lua_pushboolean(L, (_pKeyState & KMOD_SHIFT) ? TRUE : FALSE); lua_pushboolean(L, (_pKeyState & KMOD_ALT) ? TRUE : FALSE); lua_pushboolean(L, (_pKeyState & KMOD_GUI) ? TRUE : FALSE); lua_pushnil(L); lua_pushboolean(L, (event->type == SDL_KEYUP) ? TRUE : FALSE); /* Convert unicode UCS-2 to UTF8 string */ if (event->key.keysym.sym) { wchar_t wc = event->key.keysym.sym; char buf[4] = {0,0,0,0}; if (wc < 0x80) { buf[0] = wc; } else if (wc < 0x800) { buf[0] = (0xC0 | wc>>6); buf[1] = (0x80 | (wc & 0x3F)); } else {
/**@brief Call function with current self and other instances.*/ inline Value docall(Function f, unsigned argcnt, Value *args) { return docall(f, getSelf(), getOther(), argcnt, args); }
static void f_EndElement (void *ud, const char *name) { lxp_userdata *xpu = (lxp_userdata *)ud; if (getHandle(xpu, EndElementKey) == 0) return; /* no handle */ lua_pushstring(xpu->L, name); docall(xpu, 1, 0); }
///@{ inline Value call(Function func) { return docall(func, 0, 0); }
static void f_EndNamespaceDecl (void *ud, const char *prefix) { lxp_userdata *xpu = (lxp_userdata *)ud; if (getHandle(xpu, EndNamespaceDeclKey) == 0) return; /* no handle */ lua_pushstring(xpu->L, prefix); docall(xpu, 1, 0); }
inline Value call(Function func, const Value &arg0, const Value &arg1) { Value args[] = {arg0, arg1}; return docall(func, 2, args); }
/* ** Check whether there is pending Cdata, and call its handle if necessary */ static void dischargestring (lxp_userdata *xpu) { assert(xpu->state == XPSstring); xpu->state = XPSok; luaL_pushresult(xpu->b); docall(xpu, 1, 0); }
inline Value call(Function func, const Value &arg0, const Value &arg1, const Value &arg2, const Value &arg3, const Value &arg4, const Value &arg5) { Value args[] = {arg0, arg1, arg2, arg3, arg4, arg5}; return docall(func, 6, args); }
static int lua_parse_and_execute(lua_State * L, char *input_code) { int error = 0; if (zstr(input_code)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No code to execute!\n"); return 1; } while(input_code && (*input_code == ' ' || *input_code == '\n' || *input_code == '\r')) input_code++; if (*input_code == '~') { char *buff = input_code + 1; error = luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 0, 0); //lua_pcall(L, 0, 0, 0); } else if (!strncasecmp(input_code, "#!/lua", 6)) { char *buff = input_code + 6; error = luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 0, 0); //lua_pcall(L, 0, 0, 0); } else { char *args = strchr(input_code, ' '); if (args) { char *code = NULL; int x, argc; char *argv[128] = { 0 }; *args++ = '\0'; if ((argc = switch_separate_string(args, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { switch_stream_handle_t stream = { 0 }; SWITCH_STANDARD_STREAM(stream); stream.write_function(&stream, " argv = {[0]='%y', ", input_code); for (x = 0; x < argc; x++) { stream.write_function(&stream, "'%y'%s", argv[x], x == argc - 1 ? "" : ", "); } stream.write_function(&stream, " };"); code = (char *) stream.data; } else { code = switch_mprintf("argv = {[0]='%s'};", input_code); } if (code) { error = luaL_loadbuffer(L, code, strlen(code), "line") || docall(L, 0, 0, 0); switch_safe_free(code); } } else { // Force empty argv table char *code = NULL; code = switch_mprintf("argv = {[0]='%s'};", input_code); error = luaL_loadbuffer(L, code, strlen(code), "line") || docall(L, 0, 0, 0); switch_safe_free(code); } if (!error) { char *file = input_code, *fdup = NULL; if (!switch_is_file_path(file)) { fdup = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.script_dir, file); switch_assert(fdup); file = fdup; } error = luaL_loadfile(L, file) || docall(L, 0, 0, 0); switch_safe_free(fdup); } } if (error) { const char *err = lua_tostring(L, -1); if (!zstr(err)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err); } lua_pop(L, 1); /* pop error message from the stack */ } return error; }
static int dochunk (lua_State *L, int status) { if (status == LUA_OK) status = docall(L, 0, 0); return report(L, status); }
int study_book(struct obj *spellbook, const struct nh_cmd_arg *arg) { int booktype = spellbook->otyp; boolean confused = (Confusion != 0); boolean too_hard = FALSE; if (u.uoccupation_progress[tos_book] && !confused && spellbook == u.utracked[tos_book] && /* handle the sequence: start reading, get interrupted, have book become erased somehow, resume reading it */ booktype != SPE_BLANK_PAPER) { if (turnstate.continue_message) pline("You continue your efforts to memorize the spell."); } else { /* Restarting reading the book */ /* KMH -- Simplified this code */ if (booktype == SPE_BLANK_PAPER) { pline("This spellbook is all blank."); makeknown(booktype); return 1; } switch (objects[booktype].oc_level) { case 1: case 2: u.uoccupation_progress[tos_book] = -objects[booktype].oc_delay; break; case 3: case 4: u.uoccupation_progress[tos_book] = -(objects[booktype].oc_level - 1) * objects[booktype].oc_delay; break; case 5: case 6: u.uoccupation_progress[tos_book] = -objects[booktype].oc_level * objects[booktype].oc_delay; break; case 7: u.uoccupation_progress[tos_book] = -8 * objects[booktype].oc_delay; break; default: impossible("Unknown spellbook level %d, book %d;", objects[booktype].oc_level, booktype); return 0; } /* Books are often wiser than their readers (Rus.) */ spellbook->in_use = TRUE; if (!spellbook->blessed && spellbook->otyp != SPE_BOOK_OF_THE_DEAD) { if (spellbook->cursed) { too_hard = TRUE; } else { /* uncursed - chance to fail */ int read_ability = ACURR(A_INT) + 4 + u.ulevel / 2 - 2 * objects[booktype].oc_level + ((ublindf && ublindf->otyp == LENSES) ? 2 : 0); /* only wizards know if a spell is too difficult */ if (Role_if(PM_WIZARD) && read_ability < 20 && !confused) { const char *qbuf; qbuf = msgprintf("This spellbook is %sdifficult to " "comprehend. Continue?", (read_ability < 12 ? "very " : "")); if (yn(qbuf) != 'y') { spellbook->in_use = FALSE; return 1; } } /* it's up to random luck now */ if (rnd(20) > read_ability) { too_hard = TRUE; } } } if (too_hard) { boolean gone = cursed_book(spellbook); helpless(-u.uoccupation_progress[tos_book], hr_paralyzed, "frozen by a spellbook", NULL); u.uoccupation_progress[tos_book] = 0; if (gone || !rn2(3)) { if (!gone) pline("The spellbook crumbles to dust!"); if (!objects[spellbook->otyp].oc_name_known && !objects[spellbook->otyp].oc_uname) docall(spellbook); useup(spellbook); } else spellbook->in_use = FALSE; return 1; } else if (confused) { if (!confused_book(spellbook)) { spellbook->in_use = FALSE; } helpless(-u.uoccupation_progress[tos_book], hr_busy, "absorbed in a spellbook", "You're finally able to put the book down."); u.uoccupation_progress[tos_book] = 0; u.utracked[tos_book] = 0; return 1; } spellbook->in_use = FALSE; pline("You begin to %s the runes.", spellbook->otyp == SPE_BOOK_OF_THE_DEAD ? "recite" : "memorize"); } u.utracked[tos_book] = spellbook; one_occupation_turn(learn, "studying", occ_book); return 1; }
static int dofile (lua_State *L, const char *name) { int status = luaL_loadfile(L, name) || docall(L, 0, 1); return report(L, status); }
int main(int argc, char **argv) { int pid, status, set = 0; uint64_t rax; uint64_t kern_s = 0xffffffff80000000; uint64_t kern_e = 0xffffffff84000000; uint64_t off = 0x0000000800000101 * 8; if (argc == 4) { docall((uint64_t*)(kern_s + off), kern_e - kern_s); exit(0); } if ((pid = fork()) == 0) { ptrace(PTRACE_TRACEME, 0, 0, 0); execl(argv[0], argv[0], "2", "3", "4", NULL); perror("exec fault"); exit(1); } if (pid == -1) { printf("fork fault\n"); exit(1); } for (;;) { if (wait(&status) != pid) continue; if (WIFEXITED(status)) { printf("Process finished\n"); break; } if (!WIFSTOPPED(status)) continue; if (WSTOPSIG(status) != SIGTRAP) { printf("Process received signal: %d\n", WSTOPSIG(status)); break; } rax = ptrace(PTRACE_PEEKUSER, pid, 8*ORIG_RAX, 0); if (rax == 0x000000000101) { if (ptrace(PTRACE_POKEUSER, pid, 8*ORIG_RAX, off/8) == -1) { printf("PTRACE_POKEUSER fault\n"); exit(1); } set = 1; //rax = ptrace(PTRACE_PEEKUSER, pid, 8*ORIG_RAX, 0); } if ((rax == 11) && set) { ptrace(PTRACE_DETACH, pid, 0, 0); for(;;) sleep(10000); } if (ptrace(PTRACE_SYSCALL, pid, 1, 0) == -1) { printf("PTRACE_SYSCALL fault\n"); exit(1); } } return 0; }
static int handle_argv (lua_State *L, int argc, char **argv, int *interactive) { if (argv[1] == NULL) { /* no arguments? */ *interactive = 0; if (lua_stdin_is_tty()) dotty(L); else dofile(L, NULL); /* executes stdin as a file */ } else { /* other arguments; loop over them */ int i; for (i = 1; argv[i] != NULL; i++) { if (argv[i][0] != '-') break; /* not an option? */ switch (argv[i][1]) { /* option */ case '-': { /* `--' */ if (argv[i][2] != '\0') { print_usage(); return 1; } i++; /* skip this argument */ goto endloop; /* stop handling arguments */ } case '\0': { clearinteractive(interactive); dofile(L, NULL); /* executes stdin as a file */ break; } case 'i': { *interactive = 2; /* force interactive mode after arguments */ break; } case 'v': { clearinteractive(interactive); print_version(); break; } case 'e': { const char *chunk = argv[i] + 2; clearinteractive(interactive); if (*chunk == '\0') chunk = argv[++i]; if (chunk == NULL) { print_usage(); return 1; } if (dostring(L, chunk, "=(command line)") != 0) return 1; break; } case 'l': { const char *filename = argv[i] + 2; if (*filename == '\0') filename = argv[++i]; if (filename == NULL) { print_usage(); return 1; } if (dolibrary(L, filename)) return 1; /* stop if file fails */ break; } default: { clearinteractive(interactive); print_usage(); return 1; } } } endloop: if (argv[i] != NULL) { int status; const char *filename = argv[i]; int narg = getargs(L, argc, argv, i); /* collect arguments */ lua_setglobal(L, "arg"); clearinteractive(interactive); status = luaL_loadfile(L, filename); lua_insert(L, -(narg+1)); if (status == 0) status = docall(L, narg, 0); else lua_pop(L, narg); return report(L, status); } } return 0; }
inline Value call(Function func, const Value &arg0, const Value &arg1, const Value &arg2, const Value &arg3, const Value &arg4, const Value &arg5, const Value &arg6, const Value &arg7, const Value &arg8, const Value &arg9, const Value &arg10, const Value &arg11, const Value &arg12, const Value &arg13, const Value &arg14, const Value &arg15) { Value args[] = {arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15}; return docall(func, 16, args); }
static int dofile (lua_State *L, const char *name) { int status = luaL_loadfile(L, name); if (status == LUA_OK) status = docall(L, 0, 0); return report(L, status); }
static int dostring (const char *s, const char *name) { return docall(luaL_loadbuffer(L, s, strlen(s), name)); }