diff --git a/build/src/CMakeFiles/hook_aurora.dir/l_squirrel.cpp.o b/build/src/CMakeFiles/hook_aurora.dir/l_squirrel.cpp.o index bfac6d1..3563d98 100644 Binary files a/build/src/CMakeFiles/hook_aurora.dir/l_squirrel.cpp.o and b/build/src/CMakeFiles/hook_aurora.dir/l_squirrel.cpp.o differ diff --git a/src/l_squirrel.cpp b/src/l_squirrel.cpp index 38aa6d8..d33f394 100644 --- a/src/l_squirrel.cpp +++ b/src/l_squirrel.cpp @@ -229,6 +229,16 @@ void InitSquirrel() ReqSquirrelScript(v); } + // 执行虚拟机Main函数 + SQInteger top = sq_gettop(v); // saves the stack size before the call + sq_pushroottable(v); // pushes the global table + sq_pushstring(v, _SC("main"), -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 sq_pushroottable(v); sq_pushstring(v, "sq_ReloadScript", -1);