使用 C++ 从 lua_State 获取值失败

我想从 lua_State 结构中获取值,但我发现值出现了错误。


void func(lua_State* L)
{
        lu_mem nBytes     = 0; // 总内存
        int    stacksize  = 0; // 栈大小
        int    sweepstrgc = 0; // 垃圾回收扫描字符串
        lu_mem estimate   = 0; // 估计值

        nBytes     = L->l_G->totalbytes;
        stacksize  = L->stacksize;
        sweepstrgc = L->l_G->sweepstrgc;
        estimate   = L->l_G->estimate;
}

像上面的示例一样,例如,totalbytes 是 1270000,但 nBytes 始终为 6。问题出在哪里?感谢任何帮助。

原文链接 https://stackoverflow.com/questions/69202039

点赞
stackoverflow用户12594147
stackoverflow用户12594147

\* 实际分配字节数 \*/ 获取总分配字节数(g) = (g)->totalbytes + (g)->GCdebt

2021-09-17 06:39:16