Reputation: 93
I have a c++ macro that looks like this
#define lua_tpushstring(L,n,f) \
(lua_pushstring(L, n), lua_pushstring(L, f))
I want to modify it so it works like this
#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", "");
What is the simple change?
Upvotes: 2
Views: 685
Reputation: 70088
Just put ##
before TYPE
.
#define lua_tpush(TYPE,L,n,f) \
(lua_pushstring(L, n), lua_push##TYPE(L, f))
^^^^^^ did you wanted ##TYPE here
Upvotes: 3
Reputation: 477504
#define lua_tpush(TYPE,L,n,f) (lua_pushstring(L, n), lua_push##TYPE(L, f))
Upvotes: 6