static int lua_script_start( char const* script ) { L = lua_open(); luaL_openlibs( L ); register_lua_funcs( L ); Lt = lua_newthread( L ); lua_setfield( L, LUA_REGISTRYINDEX, "Lt" ); if( luaL_loadstring( Lt, script ) != 0 ) { script_console_add_line( lua_tostring( Lt, -1 ) ); lua_script_reset( L ); return 0; } lua_sethook(Lt, lua_count_hook, LUA_MASKCOUNT, 1000 ); return 1; }
int lua_script_start( char const* script, int ptp ) { lua_script_is_ptp = ptp; L = lua_open(); luaL_openlibs( L ); register_lua_funcs( L ); Lt = lua_newthread( L ); lua_setfield( L, LUA_REGISTRYINDEX, "Lt" ); if( luaL_loadstring( Lt, script ) != 0 ) { lua_script_error(Lt,0); return 0; } lua_sethook(Lt, lua_count_hook, LUA_MASKCOUNT, 1000 ); lua_script_enable_yield_hook(); return 1; }