bool CreateConstructNativeClassInstance(HSQUIRRELVM v, const SQChar * className) { int oldtop = sq_gettop(v); sq_pushroottable(v); sq_pushstring(v, className, -1); if (SQ_FAILED(sq_rawget(v, -2))) { // Get the class (created with sq_newclass()). sq_settop(v, oldtop); return false; } // if #if 0 sq_remove(v, -3); // Remove the root table. sq_push(v, 1); // Push the 'this'. #else // Kamaitati's change. 5/28/06 jcs. sq_remove(v, -2); // Remove the root table. sq_pushroottable(v); // Push the 'this'. #endif if (SQ_FAILED(sq_call(v, 1, SQTrue, false))) { // Call ClassName(): creates new instance and calls constructor (instead of sq_createinstance() where constructor is not called). sq_settop(v, oldtop); return false; } // if sq_remove(v, -2); // Remove the class. // int newtop = sq_gettop(v); return true; } // CreateConstructNativeClassInstance
void CScripts::onInit(int iScript) { if(m_pScripts[iScript]) { // get the script vm pointer SQVM * pVM = m_pScripts[iScript]->GetVM(); // Get the stack top int iTop = sq_gettop(pVM); // Push the root table onto the stack sq_pushroottable(pVM); // Push the function name onto the stack sq_pushstring(pVM, "onInit", -1); // Get the closure for the function if(SQ_SUCCEEDED(sq_get(pVM, -2))) { // Push the root table onto the stack sq_pushroottable(pVM); // Call the function sq_call(pVM, 1, true, true); } // Restore the stack top sq_settop(pVM, iTop); } }
void CScripts::onTimerCreate(int timerId) { for(int i = 0; i < MAX_SCRIPTS; i++) { if(m_pScripts[i]) { // get the script vm pointer SQVM * pVM = m_pScripts[i]->GetVM(); // Get the stack top int iTop = sq_gettop(pVM); // Push the root table onto the stack sq_pushroottable(pVM); // Push the function name onto the stack sq_pushstring(pVM, "onTimerCreate", -1); // Get the closure for the function if(SQ_SUCCEEDED(sq_get(pVM, -2))) { // Push the root table onto the stack sq_pushroottable(pVM); // Push the timer id onto the stack sq_pushinteger(pVM, timerId); // Call the function sq_call(pVM, 2, true, true); } // Restore the stack top sq_settop(pVM, iTop); } } }
void CScripts::Call(const char * szFunc, int iArgCount, SQObjectPtr * pArguments) { for(int i = 0; i < MAX_SCRIPTS; i++) { if(m_pScripts[i]) { // get the script vm pointer SQVM * pVM = m_pScripts[i]->GetVM(); // Get the stack top int iTop = sq_gettop(pVM); // Push the root table onto the stack sq_pushroottable(pVM); // Push the function name onto the stack sq_pushstring(pVM, szFunc, -1); if(SQ_SUCCEEDED(sq_get(pVM, -2))) { // Push the root table onto the stack sq_pushroottable(pVM); if(pArguments != NULL) { for(int j = 0; j < iArgCount; ++j) sq_pushobject(pVM, pArguments[j]); //pVM->Push(pArguments[j]); } sq_call(pVM, iArgCount + 1, true, true); } // Restore the stack top sq_settop(pVM, iTop); } } }
/* * invoke impact event */ static SQBool invokeImpactEvent(HSQUIRRELVM v, ContactPoint cp) { SQBool result = false; SQInteger top = sq_gettop(v); sq_pushroottable(v); sq_pushstring(v, "emo", -1); if (SQ_SUCCEEDED(sq_get(v, -2))) { sq_pushstring(v, "_onImpact", -1); if(SQ_SUCCEEDED(sq_get(v, -2))) { sq_pushroottable(v); sq_pushuserpointer(v, cp.fixtureA); sq_pushuserpointer(v, cp.fixtureB); sq_pushuserpointer(v, cp.fixtureA->GetBody()); sq_pushuserpointer(v, cp.fixtureB->GetBody()); pushVec2(v, cp.position); pushVec2(v, cp.normal); sq_pushfloat(v, cp.normalImpulse); sq_pushfloat(v, cp.tangentImpulse); result = SQ_SUCCEEDED(sq_call(v, 9, SQFalse, SQTrue)); } } sq_settop(v,top); return result; }
void CScripts::onBan(const char *szText) { for(int i = 0; i < MAX_SCRIPTS; i++) { if(m_pScripts[i]) { // get the script vm pointer SQVM * pVM = m_pScripts[i]->GetVM(); // Get the stack top int iTop = sq_gettop(pVM); // Push the root table onto the stack sq_pushroottable(pVM); // Push the function name onto the stack sq_pushstring(pVM, "onBan", -1); // Get the closure for the function if(SQ_SUCCEEDED(sq_get(pVM, -2))) { // Push the root table onto the stack sq_pushroottable(pVM); // Push the ban mask onto the stack sq_pushstring(pVM, szText, -1); // Call the function sq_call(pVM, 2, true, true); } // Restore the stack top sq_settop(pVM, iTop); } } }
static void call(HSQUIRRELVM v, const wgChar *devicename) { sq_pushroottable(v); sq_pushstring(v, _SC("flash_device_get"), -1); if(SQ_SUCCEEDED(sq_get(v,-2))){ sq_pushroottable(v); sq_pushstring(v, devicename, -1); sq_call(v, 2, SQTrue, SQTrue); } }
void sc_OnGameModeInit(HSQUIRRELVM v) { int top = sq_gettop(v); sq_pushroottable(v); sq_pushstring(v, _SC("OnGameModeInit"), -1); if (SQ_SUCCEEDED(sq_get(v, -2))) { sq_pushroottable(v); sq_call(v, 1, 0, 1); } sq_settop(v, top); }
void sc_CommandCallback(HSQUIRRELVM v, const wchar_t *callback, const unsigned char numargs) { int top = sq_gettop(v); sq_pushroottable(v); sq_pushstring(v, callback, -1); if(SQ_SUCCEEDED(sq_get(v, -2))) { sq_pushroottable(v); sq_pushinteger(v, numargs); sq_call(v, 2, 0, 1); } sq_settop(v, top); }
void sc_OnPlayerSpawn(HSQUIRRELVM v, const short index) { int top = sq_gettop(v); sq_pushroottable(v); sq_pushstring(v, _SC("OnPlayerSpawn"), -1); if (SQ_SUCCEEDED(sq_get(v, -2))) { sq_pushroottable(v); sq_pushinteger(v, index); sq_call(v, 2, 0, 1); } sq_settop(v, top); }
int sqlang_sr_init_child(void) { memset(&_sr_J_env, 0, sizeof(sr_sqlang_env_t)); _sr_J_env.J = sq_open(1024); if(_sr_J_env.J==NULL) { LM_ERR("cannot create SQlang context (exec)\n"); return -1; } sq_pushroottable(_sr_J_env.J); /*sets the print functions*/ sq_setprintfunc(_sr_J_env.J, sqlang_printfunc, sqlang_errorfunc); //sq_setnativedebughook(_sr_J_env.J, sqlang_debughook); sq_enabledebuginfo(_sr_J_env.J, 1); sqstd_register_bloblib(_sr_J_env.J); sqstd_register_iolib(_sr_J_env.J); sqstd_register_systemlib(_sr_J_env.J); sqstd_register_mathlib(_sr_J_env.J); sqstd_register_stringlib(_sr_J_env.J); sqstd_seterrorhandlers(_sr_J_env.J); sqlang_sr_kemi_register_libs(_sr_J_env.J); if(_sr_sqlang_load_file.s != NULL && _sr_sqlang_load_file.len>0) { _sr_J_env.JJ = sq_open(1024); if(_sr_J_env.JJ==NULL) { LM_ERR("cannot create load SQLang context (load)\n"); return -1; } sq_pushroottable(_sr_J_env.JJ); LM_DBG("*** sqlang top index now is: %d\n", (int)sqlang_gettop(_sr_J_env.JJ)); /*sets the print functions*/ sq_setprintfunc(_sr_J_env.JJ, sqlang_printfunc, sqlang_errorfunc); //sq_setnativedebughook(_sr_J_env.JJ, sqlang_debughook); sq_enabledebuginfo(_sr_J_env.JJ, 1); sqstd_register_bloblib(_sr_J_env.JJ); sqstd_register_iolib(_sr_J_env.JJ); sqstd_register_systemlib(_sr_J_env.JJ); sqstd_register_mathlib(_sr_J_env.JJ); sqstd_register_stringlib(_sr_J_env.JJ); sqstd_seterrorhandlers(_sr_J_env.JJ); sqlang_sr_kemi_register_libs(_sr_J_env.JJ); LM_DBG("loading sqlang script file: %.*s\n", _sr_sqlang_load_file.len, _sr_sqlang_load_file.s); if(sqlang_kemi_load_script()<0) { return -1; } } LM_DBG("JS initialized!\n"); return 0; }
void call_print_hulla(HSQUIRRELVM v) { SQInteger top = sq_gettop(v); //saves the stack size before the call sq_pushroottable(v); //pushes the global table sq_pushstring(v, _SC("hola"), -1); if (SQ_SUCCEEDED(sq_get(v, -2))) { //gets the field 'foo' from the global table sq_pushroottable(v); //push the 'this' (in this case is the global table) sq_call(v, 1, SQFalse, SQTrue); //calls the function } sq_settop(v, top); //restores the original stack size }
void sc_OnPlayerDeath(HSQUIRRELVM v, const short playerindex, const short killerindex, const char reason) { int top = sq_gettop(v); sq_pushroottable(v); sq_pushstring(v, _SC("OnPlayerDeath"), -1); if (SQ_SUCCEEDED(sq_get(v, -2))) { sq_pushroottable(v); sq_pushinteger(v, playerindex); sq_pushinteger(v, killerindex); sq_pushinteger(v, reason); sq_call(v, 4, 0, 1); } sq_settop(v, top); }
void call_foo(HSQUIRRELVM v, int n,float f,const SQChar *s) { SQInteger top = sq_gettop(v); //saves the stack size before the call sq_pushroottable(v); //pushes the global table sq_pushstring(v,_SC("foo"),-1); if(SQ_SUCCEEDED(sq_get(v,-2))) { //gets the field 'foo' from the global table sq_pushroottable(v); //push the 'this' (in this case is the global table) sq_pushinteger(v,n); sq_pushfloat(v,f); sq_pushstring(v,s,-1); sq_call(v,4,SQFalse,SQTrue); //calls the function } sq_settop(v,top); //restores the original stack size }
void sc_OnPlayerShoot(HSQUIRRELVM v, const short index, float shoot[3]) { int top = sq_gettop(v); sq_pushroottable(v); sq_pushstring(v, _SC("OnPlayerShoot"), -1); if(SQ_SUCCEEDED(sq_get(v, -2))) { sq_pushroottable(v); sq_pushinteger(v, index); sq_pushfloat(v, shoot[0]); sq_pushfloat(v, shoot[1]); sq_pushfloat(v, shoot[2]); sq_call(v, 5, 0, 1); } sq_settop(v, top); }
void EventListener::ProcessEvent(Rocket::Core::Event& event) { HSQUIRRELVM vm = Module::instance().getScriptInterface().getSquirrelVM(); if (!mScript.IsCompiled()) { } mScript.Compile(vm, false); GlobalUtility gutil(vm, m_pElement->GetOwnerDocument(), m_pElement, &event); SQInteger i = sq_gettop(vm); SQRESULT sqr; gutil.Set(); Module::instance().getScriptInterface().PushDocumentTable(vm, m_pElement->GetOwnerDocument()); sqr = sq_bindenv(vm, i); ROCKETSQUIRREL_ASSERT(SQ_SUCCEEDED(sqr)); sq_pushroottable(vm); mScript.Run(vm); gutil.Restore(); sq_pop(vm, i); return; }
/* * load squirrel script from given file name */ bool loadScript(const char* fname) { FILE* fp = fopen(fname, "r"); if (fp == NULL) { engine->setLastError(ERR_SCRIPT_OPEN); LOGW("loadScript: failed to open main script file"); LOGW(fname); return false; } if (SQ_SUCCEEDED(sq_compile(engine->sqvm, sq_lexer_fp, fp, fname, SQTrue))) { sq_pushroottable(engine->sqvm); if (SQ_FAILED(sq_call(engine->sqvm, 1, SQFalse, SQTrue))) { engine->setLastError(ERR_SCRIPT_CALL_ROOT); LOGW("loadScript: failed to sq_call"); LOGW(fname); fclose(fp); return false; } } else { engine->setLastError(ERR_SCRIPT_COMPILE); LOGW("loadScript: failed to compile squirrel script"); LOGW(fname); fclose(fp); return false; } fclose(fp); return true; }
void BindInput() { Sqrat::Class<CInput, Sqrat::NoConstructor> def; def.Func("KeyUp", &CInput::KeyUp); def.Func("KeyPressed", &CInput::KeyPressed); def.Func("KeyHeld", &CInput::KeyHeld); def.Func("KeyReleased", &CInput::KeyReleased); Sqrat::RootTable().Bind("InputSystem", def); //Sqrat::ConstTable().Const("KEY_LEFT", KEY_LEFT); MAKE_KEY( KEY_LEFT ); MAKE_KEY( KEY_RIGHT ); MAKE_KEY( KEY_UP ); MAKE_KEY( KEY_DOWN ); MAKE_KEY( KEY_Q ); MAKE_KEY( KEY_W ); MAKE_KEY( KEY_PAGEUP ); MAKE_KEY( KEY_PAGEDOWN ); MAKE_KEY( KEY_HOME ); // Push the singleton to squirrel sq_pushroottable( Sqrat::DefaultVM::Get() ); sq_pushstring( Sqrat::DefaultVM::Get(), "InputSystem", -1 ); sq_get( Sqrat::DefaultVM::Get(), -2 ); sq_pushstring( Sqrat::DefaultVM::Get(), "Input", -1 ); sq_createinstance( Sqrat::DefaultVM::Get(), -2 ); sq_setinstanceup( Sqrat::DefaultVM::Get(), -1, (SQUserPointer)Input() ); sq_newslot( Sqrat::DefaultVM::Get(), -4, SQFalse ); sq_pop( Sqrat::DefaultVM::Get(), 2 ); }
int main(int argc, char* argv[]) { HSQUIRRELVM v; v = sq_open(1024); // creates a VM with initial stack size 1024 //REGISTRATION OF STDLIB //sq_pushroottable(v); //push the root table where the std function will be registered //sqstd_register_iolib(v); //registers a library // ... call here other stdlibs string,math etc... //sq_pop(v,1); //pops the root table //END REGISTRATION OF STDLIB sqstd_seterrorhandlers(v); //registers the default error handlers sq_setprintfunc(v, printfunc,errorfunc); //sets the print function sq_pushroottable(v); //push the root table(were the globals of the script will be stored) if(SQ_SUCCEEDED(sqstd_dofile(v, _SC("test.nut"), SQFalse, SQTrue))) // also prints syntax errors if any { call_foo(v,1,2.5,_SC("teststring")); } sq_pop(v,1); //pops the root table sq_close(v); return 0; }
void SqEnv::_init(size_t sz) { // AutoLock a(&_m); __vm = sq_open(sz); _vm= &__vm; assert( *_vm ); Sqrat::DefaultVM::Set(*_vm); sq_setprintfunc(*_vm, SqEnv::print_func, SqEnv::print_func); sq_newclosure(*_vm, SqEnv::error_handler,0); sq_seterrorhandler(*_vm); //sq sq_pushroottable(*_vm); sqstd_register_iolib(*_vm); sqstd_register_bloblib(*_vm); sqstd_register_mathlib(*_vm); sqstd_register_stringlib(*_vm); sqstd_register_systemlib(*_vm); sqstd_seterrorhandlers(*_vm); sqstd_printcallstack(*_vm); // setnativedebughook(_vmsys,debug_hook); sq_notifyallexceptions(*_vm, true); }
HSQOBJECT class_init(HSQUIRRELVM v,SQFUNCTION c,const SQChar * p_name) { HSQOBJECT class_id; sq_pushroottable(v); sq_pushstring(v,p_name,-1); sq_newclass(v,SQFalse); sq_getstackobj(v,-1,&class_id); sq_settypetag(v,-1,&class_id); HSQOBJECT string_constructor; sq_pushstring(v,_SC("constructor"),-1); sq_resetobject(&string_constructor); sq_getstackobj(v,-1,&string_constructor); sq_newclosure(v,c,0); sq_newslot(v,-3,false); sq_pushstring(v,_SC("_cloned"),-1); sq_newclosure(v,clone<T>,0); sq_newslot(v,-3,false); sq_newslot(v,-3,false); sq_pop(v,1); return class_id; }
void SquirrelThread::initThread(HSQUIRRELVM parentVm) { m_oldTop = -1; m_parentVm = parentVm; createThread(); // create a local environment for the m_thread HSQOBJECT env; sq_resetobject(&env); sq_newtable(m_thread); // store the object in env if(sq_getstackobj(m_thread, -1, &env) < 0) { return; } sq_addref(m_thread, &env); sq_pop(m_thread, 1); // remove env from stack // set old roottable as delegate on env sq_pushobject(m_thread, env); // push env sq_pushroottable(m_thread); // [env, root] sq_setdelegate(m_thread, -2); // env.set_delegate(root) sq_pop(m_thread, 1); // pop env // set env as new roottable sq_pushobject(m_thread, env); sq_setroottable(m_thread); sq_release(m_thread, &env); }
NITRENDER_API SQRESULT NitLibRender(HSQUIRRELVM v) { NB_RenderSpec::Register(v); NB_RenderContext::Register(v); NB_RenderDevice::Register(v); NB_RenderView::Register(v); NB_RenderService::Register(v); // TODO: Do not expose GLES* NB_GLESTexture::Register(v); NB_GLESTextureManager::Register(v); //////////////////////////////////// sq_pushroottable(v); if (g_Service) { NitBind::newSlot(v, -1, "render", g_Render); } sq_poptop(v); return SQ_OK; }
/** Run the dummy info.nut. */ void Script_CreateDummyInfo(HSQUIRRELVM vm, const char *type, const char *dir) { char dummy_script[4096]; char *dp = dummy_script; dp += seprintf(dp, lastof(dummy_script), "class Dummy%s extends %sInfo {\n", type, type); dp += seprintf(dp, lastof(dummy_script), "function GetAuthor() { return \"OpenTTD Developers Team\"; }\n"); dp += seprintf(dp, lastof(dummy_script), "function GetName() { return \"Dummy%s\"; }\n", type); dp += seprintf(dp, lastof(dummy_script), "function GetShortName() { return \"DUMM\"; }\n"); dp += seprintf(dp, lastof(dummy_script), "function GetDescription() { return \"A Dummy %s that is loaded when your %s/ dir is empty\"; }\n", type, dir); dp += seprintf(dp, lastof(dummy_script), "function GetVersion() { return 1; }\n"); dp += seprintf(dp, lastof(dummy_script), "function GetDate() { return \"2008-07-26\"; }\n"); dp += seprintf(dp, lastof(dummy_script), "function CreateInstance() { return \"Dummy%s\"; }\n", type); dp += seprintf(dp, lastof(dummy_script), "} RegisterDummy%s(Dummy%s());\n", type, type); const SQChar *sq_dummy_script = dummy_script; sq_pushroottable(vm); /* Load and run the script */ if (SQ_SUCCEEDED(sq_compilebuffer(vm, sq_dummy_script, strlen(sq_dummy_script), "dummy", SQTrue))) { sq_push(vm, -2); if (SQ_SUCCEEDED(sq_call(vm, 1, SQFalse, SQTrue))) { sq_pop(vm, 1); return; } } NOT_REACHED(); }
void sq_base_register(HSQUIRRELVM v) { SQInteger i=0; sq_pushroottable(v); while(base_funcs[i].name!=0) { sq_pushstring(v,base_funcs[i].name,-1); sq_newclosure(v,base_funcs[i].f,0); sq_setnativeclosurename(v,-1,base_funcs[i].name); sq_setparamscheck(v,base_funcs[i].nparamscheck,base_funcs[i].typemask); sq_createslot(v,-3); i++; } sq_pushstring(v,_SC("_version_"),-1); sq_pushstring(v,SQUIRREL_VERSION,-1); sq_createslot(v,-3); sq_pushstring(v,_SC("_charsize_"),-1); sq_pushinteger(v,sizeof(SQChar)); sq_createslot(v,-3); sq_pushstring(v,_SC("_intsize_"),-1); sq_pushinteger(v,sizeof(SQInteger)); sq_createslot(v,-3); sq_pushstring(v,_SC("_floatsize_"),-1); sq_pushinteger(v,sizeof(SQFloat)); sq_createslot(v,-3); sq_pop(v,1); }
/* * create a instance */ SQInteger createSQObject(HSQUIRRELVM v, const char* package_name, const char* name, SQUserPointer ptr, SQRELEASEHOOK releaseHook) { sq_pushroottable(v); sq_pushstring(v, package_name, -1); if (!SQ_SUCCEEDED(sq_get(v, -2))) { sq_pop(v, 1); return 0; } if (name != NULL) { sq_pushstring(v, name, -1); if (!SQ_SUCCEEDED(sq_get(v, -2))) { sq_pop(v, 2); return 0; } } sq_createinstance(v, -1); sq_setinstanceup(v, -1, ptr); if (releaseHook != NULL) { sq_setreleasehook(v, -1, releaseHook); } sq_remove(v, -2); sq_remove(v, -2); return 1; }
void CSquirrelVM::BeginRegisterScriptClass(const char* className, scriptFunction pfnFunction, void* userPointer, const char* baseClass) { iFuncIndex = 0; #if 1 int n = 0; oldtop = sq_gettop(m_pVM); sq_pushroottable(m_pVM); sq_pushstring(m_pVM, className, -1); if(baseClass) { sq_pushstring(m_pVM, baseClass, -1); if(SQ_FAILED(sq_get(m_pVM, -3))) { // make sure base exists sq_settop(m_pVM, oldtop); return; } } if(SQ_FAILED(sq_newclass(m_pVM, baseClass ? 1 : 0))) { sq_settop(m_pVM, oldtop); return; } sq_pushstring(m_pVM, _SC("constructor"), -1); if (userPointer != nullptr) { sq_pushuserpointer(m_pVM, userPointer); sq_newclosure(m_pVM, (SQFUNCTION) pfnFunction, 1); } else sq_newclosure(m_pVM, (SQFUNCTION)pfnFunction, 0); sq_newslot(m_pVM, -3, false); // Add the constructor method #endif }
bool _sort_compare(HSQUIRRELVM v,SQObjectPtr &a,SQObjectPtr &b,SQInteger func,SQInteger &ret) { if(func < 0) { if(!v->ObjCmp(a,b,ret)) return false; } else { SQInteger top = sq_gettop(v); sq_push(v, func); sq_pushroottable(v); v->Push(a); v->Push(b); if(SQ_FAILED(sq_call(v, 3, SQTrue, SQFalse))) { if(!sq_isstring( v->_lasterror)) v->Raise_Error(_SC("compare func failed")); return false; } if(SQ_FAILED(sq_getinteger(v, -1, &ret))) { v->Raise_Error(_SC("numeric value expected as return value of the compare function")); return false; } sq_settop(v, top); return true; } return true; }
static SQRESULT sq_mysql_exec_query(HSQUIRRELVM v){ SQ_FUNC_VARS_NO_TOP(v); GET_mysql_INSTANCE(); SQ_GET_STRING(v, 2, szSQL); if (dlmysql_real_query(self, szSQL, szSQL_size)) /* error executing query */ return sq_throwerror(v, _SC("error executing query. MySQL: %s"), dlmysql_error(self)); MYSQL_RES *qres = dlmysql_store_result(self); sq_pushroottable(v); sq_pushstring(v, MySQL_Result_TAG, -1); if(sq_get(v, -2) == SQ_OK){ if(sq_createinstance(v, -1) == SQ_OK){ sq_setinstanceup(v, -1, qres); sq_setreleasehook(v, -1, sq_mysql_result_releasehook); sq_pushstring(v, _curr_row_key, -1); sq_pushinteger(v, -1); sq_set(v, -3); return 1; } } return SQ_ERROR; }
void init_streamclass(HSQUIRRELVM v) { sq_pushregistrytable(v); sq_pushstring(v,_SC("std_stream"),-1); if(SQ_FAILED(sq_get(v,-2))) { sq_pushstring(v,_SC("std_stream"),-1); sq_newclass(v,SQFalse); sq_settypetag(v,-1,(SQUserPointer)SQSTD_STREAM_TYPE_TAG); SQInteger i = 0; while(_stream_methods[i].name != 0) { const SQRegFunction &f = _stream_methods[i]; sq_pushstring(v,f.name,-1); sq_newclosure(v,f.f,0); sq_setparamscheck(v,f.nparamscheck,f.typemask); sq_newslot(v,-3,SQFalse); i++; } sq_newslot(v,-3,SQFalse); sq_pushroottable(v); sq_pushstring(v,_SC("stream"),-1); sq_pushstring(v,_SC("std_stream"),-1); sq_get(v,-4); sq_newslot(v,-3,SQFalse); sq_pop(v,1); } else { sq_pop(v,1); //result } sq_pop(v,1); }