@@ -252,32 +252,32 @@ DWORD __stdcall executeLuaHook(unsigned long* args) {
252252 return 0 ;
253253 }
254254
255- lua_rawgeti (L , LUA_REGISTRYINDEX, luaHookedFunctionReference);
255+ lua_rawgeti (LC , LUA_REGISTRYINDEX, luaHookedFunctionReference);
256256
257- if (lua_isfunction (L , -1 )) {
257+ if (lua_isfunction (LC , -1 )) {
258258 int totalArgCount = luaHookedFunctionArgCount;
259259 if (luaCallingConvention == CallingConvention::THISCALL) {
260- lua_pushnumber (L , currentECXValue);
260+ lua_pushnumber (LC , currentECXValue);
261261 totalArgCount += 1 ;
262262 }
263263 for (int i = 0 ; i < luaHookedFunctionArgCount; i++) {
264- lua_pushnumber (L , args[i]);
264+ lua_pushnumber (LC , args[i]);
265265 }
266- if (lua_pcall (L , totalArgCount, 1 , 0 ) == LUA_OK) {
266+ if (lua_pcall (LC , totalArgCount, 1 , 0 ) == LUA_OK) {
267267 luaErrorLevel = 0 ;
268268 luaErrorMsg = " " ;
269- int ret = (DWORD)lua_tonumber (L , -1 );
270- lua_pop (L , 1 ); // pop off the return value;
269+ int ret = (DWORD)lua_tonumber (LC , -1 );
270+ lua_pop (LC , 1 ); // pop off the return value;
271271 return ret;
272272 }
273273 else {
274274 luaErrorLevel = 1 ;
275- luaErrorMsg = lua_tostring (L , -1 );
276- lua_pop (L , 1 ); // pop off the error message;
275+ luaErrorMsg = lua_tostring (LC , -1 );
276+ lua_pop (LC , 1 ); // pop off the error message;
277277 }
278278 }
279279 else {
280- lua_pop (L , 1 ); // we need this pop, because the getglobal does a push that would otherwise be popped by pcall.
280+ lua_pop (LC , 1 ); // we need this pop, because the getglobal does a push that would otherwise be popped by pcall.
281281 luaErrorLevel = 2 ;
282282 luaErrorMsg = std::string (luaHookedFunctionName) + " is not a function" ;
283283 }
@@ -737,54 +737,54 @@ void __stdcall GetDetourLuaTargetAndCallTheLuaFunction(DWORD address, DWORD* reg
737737 return ;
738738 }
739739
740- int before = lua_gettop (L );
740+ int before = lua_gettop (LC );
741741
742- lua_rawgeti (L , LUA_REGISTRYINDEX, entry->luaFunctionRef );
742+ lua_rawgeti (LC , LUA_REGISTRYINDEX, entry->luaFunctionRef );
743743
744- if (lua_isfunction (L , -1 )) {
745- lua_createtable (L , 0 , 8 );
744+ if (lua_isfunction (LC , -1 )) {
745+ lua_createtable (LC , 0 , 8 );
746746
747747 for (int i = 0 ; i < order.size (); i++) {
748- lua_pushstring (L , order[i].c_str ());
748+ lua_pushstring (LC , order[i].c_str ());
749749 if (order[i] == " ESP" ) {
750- lua_pushinteger (L , registers[i]+8 );
750+ lua_pushinteger (LC , registers[i]+8 );
751751 }
752752 else {
753- lua_pushinteger (L , registers[i]);
753+ lua_pushinteger (LC , registers[i]);
754754 }
755- lua_settable (L , -3 ); /* 3rd element from the stack top */
755+ lua_settable (LC , -3 ); /* 3rd element from the stack top */
756756 }
757757
758758 // We call the function and pass 1 argument and expect 1 argument in return.
759- if (lua_pcall (L , 1 , 1 , 0 ) == LUA_OK) {
759+ if (lua_pcall (LC , 1 , 1 , 0 ) == LUA_OK) {
760760 luaErrorLevel = 0 ;
761761 luaErrorMsg = " " ;
762- if (lua_istable (L , -1 )) {
762+ if (lua_istable (LC , -1 )) {
763763 /* table is in the stack at index 't' */
764- lua_pushnil (L ); /* first key */
765- while (lua_next (L , -2 ) != 0 ) {
764+ lua_pushnil (LC ); /* first key */
765+ while (lua_next (LC , -2 ) != 0 ) {
766766 /* uses 'key' (at index -2) and 'value' (at index -1) */
767- if (!lua_isstring (L , -2 )) {
767+ if (!lua_isstring (LC , -2 )) {
768768 luaErrorLevel = 6 ;
769769 luaErrorMsg = " The return value table must have string keys" ;
770770 std::cout << " [RPS]: " << std::string (luaErrorMsg) << std::endl;
771771 currentDetourReturn = retLoc;
772772
773- lua_settop (L , before);
773+ lua_settop (LC , before);
774774 return ;
775775 }
776- if (!lua_isinteger (L , -1 )) {
776+ if (!lua_isinteger (LC , -1 )) {
777777 luaErrorLevel = 5 ;
778778 luaErrorMsg = " The return value table must have integer values" ;
779779 std::cout << " [RPS]: " << std::string (luaErrorMsg) << std::endl;
780780 currentDetourReturn = retLoc;
781781
782- lua_settop (L , before);
782+ lua_settop (LC , before);
783783 return ;
784784 }
785785
786- std::string key = lua_tostring (L , -2 );
787- DWORD value = lua_tointeger (L , -1 );
786+ std::string key = lua_tostring (LC , -2 );
787+ DWORD value = lua_tointeger (LC , -1 );
788788
789789 std::vector<std::string>::const_iterator it = find (order.begin (), order.end (), key);
790790 if (it == order.end ()) {
@@ -793,7 +793,7 @@ void __stdcall GetDetourLuaTargetAndCallTheLuaFunction(DWORD address, DWORD* reg
793793 std::cout << " [RPS]: " << std::string (luaErrorMsg) << std::endl;
794794 currentDetourReturn = retLoc;
795795
796- lua_settop (L , before);
796+ lua_settop (LC , before);
797797 return ;
798798 }
799799
@@ -808,39 +808,39 @@ void __stdcall GetDetourLuaTargetAndCallTheLuaFunction(DWORD address, DWORD* reg
808808
809809
810810 /* removes 'value'; keeps 'key' for next iteration */
811- lua_pop (L , 1 );
811+ lua_pop (LC , 1 );
812812 }
813- lua_pop (L , 1 ); // pop off the return value;
813+ lua_pop (LC , 1 ); // pop off the return value;
814814 currentDetourReturn = retLoc;
815815
816- lua_settop (L , before);
816+ lua_settop (LC , before);
817817 return ;
818818 }
819819 else {
820820 luaErrorLevel = 3 ;
821821 luaErrorMsg = " Detour did not return a table" ;
822822 }
823- lua_pop (L , 1 ); // pop off the return value;
823+ lua_pop (LC , 1 ); // pop off the return value;
824824 currentDetourReturn = retLoc;
825825
826- lua_settop (L , before);
826+ lua_settop (LC , before);
827827 return ;
828828 }
829829 else {
830830 luaErrorLevel = 1 ;
831- luaErrorMsg = lua_tostring (L , -1 );
832- lua_pop (L , 1 ); // pop off the error message;
831+ luaErrorMsg = lua_tostring (LC , -1 );
832+ lua_pop (LC , 1 ); // pop off the error message;
833833 }
834834 }
835835 else {
836- lua_pop (L , 1 ); // I think we need this pop, because the getglobal does a push that would otherwise be popped by pcall.
836+ lua_pop (LC , 1 ); // I think we need this pop, because the getglobal does a push that would otherwise be popped by pcall.
837837 luaErrorLevel = 2 ;
838838 luaErrorMsg = std::string (entry->luaDetourFunctionName .c_str ()) + " is not a function" ;
839839 }
840840
841841 std::cout << " [RPS]: " << std::string (luaErrorMsg) << std::endl;
842842
843- lua_settop (L , before);
843+ lua_settop (LC , before);
844844 currentDetourReturn = retLoc;
845845}
846846
0 commit comments