diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2014-10-09 14:14:05 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2014-10-09 14:14:05 +0200 |
commit | 5c37d14e53c729c10d87849408058031d96d51f1 (patch) | |
tree | a7608265d23af6f4b60c701caacdea5babfb9d52 /tolua/include | |
parent | 773bcc7ccd52dc72114b293bba9dbca1e9ae054a (diff) | |
download | crawler-5c37d14e53c729c10d87849408058031d96d51f1.tar.gz crawler-5c37d14e53c729c10d87849408058031d96d51f1.tar.bz2 |
backported C++ string handling from tolua++ to tolua
added test for string parameter in tolua test
adapted google normalizer example in crawl.conf
Diffstat (limited to 'tolua/include')
-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 |