lua_getfield(L,-1,"name");//lua_getfield(L,-1,"name")的作用等价于 lua_pushstring(L,"name") + lua_gettable(L,1) constchar*name = lua_tostring(L,-1);//在栈顶取出数据 printf("name:%s\n", name); lua_pushstring(L,"id");//压入id lua_gettable(L,1);//在lua mytable表中...
这里isprint(ch)的ch是一个char。而按照https://en.cppreference.com/w/c/string/byte/isprint的说法。这个函数接受的参数虽然是个int但它必须是个unsigned char或者EOF。否则是UB。实际上,这里对于utf-8字符串或者unicode,这里取到的ch可能为负数,于是隐式转换成int后不是一个unsigned char。在MSVC下此处会崩溃。
1 Split = function(szFullString,szSeprator) 2 local nFindStartIndex = 1 3 local nSplitIndex = 1 4 local nSplitArray = {} 5 while true do 6 local nFindLastIndex = string.find(szFullString,szSeprator,nFindStartIndex) 7 if not nFindLastIndex then 8 nSplitArray[nSplitIndex] = string...
lua_rawgeti(L, -2, i); /* get a loader */ if (lua_isnil(L, -1)) luaL_error(L, "module " LUA_QS " not found:%s", name, lua_tostring(L, -2)); lua_pushstring(L, name); //这是去加载文件,去生成一个closure放在栈顶 //这里面包含了语法分析,词法分析,最终会生成机器指令 lua_...
StringIndex namespaceIndex; TypeIndex byvalTypeIndex; TypeIndex declaringTypeIndex; TypeIndex parentIndex; TypeIndex elementTypeIndex; // we can probably remove this one. Only used for enums GenericContainerIndex genericContainerIndex; uint32_t flags; ...
int lua_dostring (lua_State *L, const char *string); int lua_dobuffer (lua_State *L, const char *buff, size_t size, const char *name); 1. 2. 3. 4. 5. 6. 7. 8. 这些函数返回 0 表示成功,或者失败时返回一个错误码:
{doubled = lua_tonumber(L,1);/*get argument*/lua_pushnumber(L, d*d);/*push result*/return1;/*number of results*/} #include<string.h>staticintCClosureStrLen(lua_State*L) {constchar* upval = lua_tostring(L, lua_upvalueindex(1));//get first upvaluelua_pushnumber(L, (int)strlen...
#include <lua.h>#include <lauxlib.h>#include <lualib.h>#include <stdio.h>#include <stdlib.h>#include <string.h>struct log {int count;};static intlagain(lua_State *L) {struct log *p = (struct log *)luaL_checkudata(L, 1, "mk.ud.log");lua_getuservalue(L, -1);const char* ...
在index.ts 中开始 hook。我们先使用Il2Cpp.perform(()=>{console.log("OK")})确认il2cpp 能够被正常 hook。然后我们就可以使用 il2cpp 获取由元数据的来的c#代码函数签名信息。 const destination = `${Il2Cpp.applicationDataPath}/${dirName}`;
LUA_API const char *lua_pushstring (lua_State *L, const char *s) { lua_lock(L); if (s == NULL) setnilvalue(s2v(L->top)); else { TString *ts; ts = luaS_new(L, s); setsvalue2s(L, L->top, ts); s = getstr(ts); /* internal copy's address */ } api_incr_top(L...