Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我从 LUAJIT 开始。
LUAJIT 具有设置模式的功能
LUA_API int luaJIT_setmode(lua_State *L, int idx, int mode);
有没有办法获得实际模式?
谢谢
我不确定您是否可以这样做,我不确定这是否适合您,但您可以编辑src/lj_dispatch.c并添加(未经测试):
src/lj_dispatch.c
int luaJIT_getmode(lua_State *L, int idx) { global_State *g = G(L); return G2J(g)->flags; }
你会在luajit.h. 我不认为这是非常务实的,但本着const_cast我认为没有理由不工作的精神。建议避免这样做的需要......
luajit.h
const_cast