我有一个看起来像这样的 C++ 宏
#define lua_tpushstring(L,n,f) \
(lua_pushstring(L, n), lua_pushstring(L, f))
我想修改它让它像这样工作
#define lua_tpush(TYPE,L,n,f) \
(lua_pushstring(L, n), lua_pushTYPE(L, f))
lua_tpush(boolean, L, "a", true);
lua_tpush(string, L, "a", "");
什么是简单的改变?
最佳答案
#define lua_tpush(TYPE,L,n,f) (lua_pushstring(L, n), lua_push##TYPE(L, f))
关于c++ - C++中的函数名宏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6909566/