diff options
Diffstat (limited to 'src/Bindings/ManualBindings.cpp')
-rw-r--r-- | src/Bindings/ManualBindings.cpp | 62 |
1 files changed, 56 insertions, 6 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index ff904d74a..7655d8c83 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -34,6 +34,7 @@ #include "../CompositeChat.h" #include "../StringCompression.h" #include "../CommandOutput.h" +#include "../BuildInfo.h" @@ -158,7 +159,7 @@ static int tolua_UncompressStringZLIB(lua_State * tolua_S) // Get the params: AString ToUncompress; - int UncompressedSize; + size_t UncompressedSize; S.GetStackValues(1, ToUncompress, UncompressedSize); // Compress the string: @@ -1801,7 +1802,7 @@ static int tolua_cMojangAPI_GetUUIDsFromPlayerNames(lua_State * L) // Convert the input table into AStringVector: AStringVector PlayerNames; int NumNames = luaL_getn(L, 2); - PlayerNames.reserve(NumNames); + PlayerNames.reserve(static_cast<size_t>(NumNames)); for (int i = 1; i <= NumNames; i++) { lua_rawgeti(L, 2, i); @@ -2079,6 +2080,50 @@ static int tolua_cLineBlockTracer_Trace(lua_State * tolua_S) +static int tolua_cRoot_GetBuildCommitID(lua_State * tolua_S) +{ + cLuaState L(tolua_S); + L.Push(BUILD_COMMIT_ID); + return 1; +} + + + + + +static int tolua_cRoot_GetBuildDateTime(lua_State * tolua_S) +{ + cLuaState L(tolua_S); + L.Push(BUILD_DATETIME); + return 1; +} + + + + + +static int tolua_cRoot_GetBuildID(lua_State * tolua_S) +{ + cLuaState L(tolua_S); + L.Push(BUILD_ID); + return 1; +} + + + + + +static int tolua_cRoot_GetBuildSeriesName(lua_State * tolua_S) +{ + cLuaState L(tolua_S); + L.Push(BUILD_SERIES_NAME); + return 1; +} + + + + + static int tolua_cRoot_GetFurnaceRecipe(lua_State * tolua_S) { cLuaState L(tolua_S); @@ -2092,7 +2137,8 @@ static int tolua_cRoot_GetFurnaceRecipe(lua_State * tolua_S) } // Check the input param: - cItem * Input = (cItem *)tolua_tousertype(L, 2, nullptr); + cItem * Input = nullptr; + L.GetStackValue(2, Input); if (Input == nullptr) { LOGWARNING("cRoot:GetFurnaceRecipe: the Input parameter is nil or missing."); @@ -2109,9 +2155,9 @@ static int tolua_cRoot_GetFurnaceRecipe(lua_State * tolua_S) } // Push the output, number of ticks and input as the three return values: - tolua_pushusertype(L, Recipe->Out, "const cItem"); - tolua_pushnumber (L, (lua_Number)(Recipe->CookTime)); - tolua_pushusertype(L, Recipe->In, "const cItem"); + L.Push(Recipe->Out); + L.Push(Recipe->CookTime); + L.Push(Recipe->In); return 3; } @@ -2868,6 +2914,10 @@ void cManualBindings::Bind(lua_State * tolua_S) tolua_function(tolua_S, "DoWithPlayerByUUID", DoWith <cRoot, cPlayer, &cRoot::DoWithPlayerByUUID>); tolua_function(tolua_S, "ForEachPlayer", ForEach<cRoot, cPlayer, &cRoot::ForEachPlayer>); tolua_function(tolua_S, "ForEachWorld", ForEach<cRoot, cWorld, &cRoot::ForEachWorld>); + tolua_function(tolua_S, "GetBuildCommitID", tolua_cRoot_GetBuildCommitID); + tolua_function(tolua_S, "GetBuildDateTime", tolua_cRoot_GetBuildDateTime); + tolua_function(tolua_S, "GetBuildID", tolua_cRoot_GetBuildID); + tolua_function(tolua_S, "GetBuildSeriesName", tolua_cRoot_GetBuildSeriesName); tolua_function(tolua_S, "GetFurnaceRecipe", tolua_cRoot_GetFurnaceRecipe); tolua_endmodule(tolua_S); |