diff options
author | madmaxoft <github@xoft.cz> | 2013-09-11 21:12:34 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-09-11 21:22:25 +0200 |
commit | 791ced42cc8d9e43768b72b0514e739f28129ea1 (patch) | |
tree | 8489b88bc92ea7ee71a6378e6c6cea8608d68c0f /source | |
parent | Merge pull request #159 from tigerw/bugfix (diff) | |
download | cuberite-791ced42cc8d9e43768b72b0514e739f28129ea1.tar cuberite-791ced42cc8d9e43768b72b0514e739f28129ea1.tar.gz cuberite-791ced42cc8d9e43768b72b0514e739f28129ea1.tar.bz2 cuberite-791ced42cc8d9e43768b72b0514e739f28129ea1.tar.lz cuberite-791ced42cc8d9e43768b72b0514e739f28129ea1.tar.xz cuberite-791ced42cc8d9e43768b72b0514e739f28129ea1.tar.zst cuberite-791ced42cc8d9e43768b72b0514e739f28129ea1.zip |
Diffstat (limited to '')
-rw-r--r-- | source/ManualBindings.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/source/ManualBindings.cpp b/source/ManualBindings.cpp index 87efecd35..0e4fe719c 100644 --- a/source/ManualBindings.cpp +++ b/source/ManualBindings.cpp @@ -92,6 +92,21 @@ static int tolua_StringSplit(lua_State * tolua_S) +static int tolua_StringSplitAndTrim(lua_State * tolua_S) +{ + cLuaState LuaState(tolua_S); + std::string str = (std::string)tolua_tocppstring(LuaState, 1, 0); + std::string delim = (std::string)tolua_tocppstring(LuaState, 2, 0); + + AStringVector Split = StringSplitAndTrim(str, delim); + LuaState.Push(Split); + return 1; +} + + + + + static int tolua_LOG(lua_State* tolua_S) { const char* str = tolua_tocppstring(tolua_S,1,0); @@ -1808,12 +1823,13 @@ static int tolua_cLineBlockTracer_Trace(lua_State * tolua_S) void ManualBindings::Bind(lua_State * tolua_S) { tolua_beginmodule(tolua_S, NULL); - tolua_function(tolua_S, "StringSplit", tolua_StringSplit); - tolua_function(tolua_S, "LOG", tolua_LOG); - tolua_function(tolua_S, "LOGINFO", tolua_LOGINFO); - tolua_function(tolua_S, "LOGWARN", tolua_LOGWARN); - tolua_function(tolua_S, "LOGWARNING", tolua_LOGWARN); - tolua_function(tolua_S, "LOGERROR", tolua_LOGERROR); + tolua_function(tolua_S, "StringSplit", tolua_StringSplit); + tolua_function(tolua_S, "StringSplitAndTrim", tolua_StringSplitAndTrim); + tolua_function(tolua_S, "LOG", tolua_LOG); + tolua_function(tolua_S, "LOGINFO", tolua_LOGINFO); + tolua_function(tolua_S, "LOGWARN", tolua_LOGWARN); + tolua_function(tolua_S, "LOGWARNING", tolua_LOGWARN); + tolua_function(tolua_S, "LOGERROR", tolua_LOGERROR); tolua_beginmodule(tolua_S, "cLineBlockTracer"); tolua_function(tolua_S, "Trace", tolua_cLineBlockTracer_Trace); |