diff options
Diffstat (limited to 'tolua/include/tolua.h')
-rwxr-xr-x | tolua/include/tolua.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tolua/include/tolua.h b/tolua/include/tolua.h index 9273de1..5f42465 100755 --- a/tolua/include/tolua.h +++ b/tolua/include/tolua.h @@ -122,6 +122,21 @@ TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def); TOLUA_API void tolua_newmetatable (lua_State* L, const char* name); TOLUA_API void tolua_getmetatable (lua_State* L, const char* name); +/* backports from tolua++-1.0.93: C++ string handling as basic type: */ + +#define tolua_pushcppstring(x,y) tolua_pushstring(x,y.c_str()) +#define tolua_iscppstring tolua_isstring + +#ifdef __cplusplus +static inline const char* tolua_tocppstring (lua_State* L, int narg, const char* def) { + + const char* s = tolua_tostring(L, narg, def); + return s?s:""; +} +#else +#define tolua_tocppstring tolua_tostring +#endif + #ifdef __cplusplus } #endif |