cMojangAPI: Fixed MakeUUID___() bindings.
ToLua would generate a shadow return value for the input strings.
This commit is contained in:
parent
b7ec75add6
commit
936604ca95
@ -2414,6 +2414,62 @@ static int tolua_cMojangAPI_GetUUIDsFromPlayerNames(lua_State * L)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int tolua_cMojangAPI_MakeUUIDDashed(lua_State * L)
|
||||||
|
{
|
||||||
|
// Function signature: cMojangAPI:MakeUUIDDashed(UUID) -> string
|
||||||
|
|
||||||
|
// Check params:
|
||||||
|
cLuaState S(L);
|
||||||
|
if (
|
||||||
|
!S.CheckParamUserTable(1, "cMojangAPI") ||
|
||||||
|
!S.CheckParamString(2) ||
|
||||||
|
!S.CheckParamEnd(3)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the params:
|
||||||
|
AString UUID;
|
||||||
|
S.GetStackValue(2, UUID);
|
||||||
|
|
||||||
|
// Push the result:
|
||||||
|
S.Push(cRoot::Get()->GetMojangAPI().MakeUUIDDashed(UUID));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int tolua_cMojangAPI_MakeUUIDShort(lua_State * L)
|
||||||
|
{
|
||||||
|
// Function signature: cMojangAPI:MakeUUIDShort(UUID) -> string
|
||||||
|
|
||||||
|
// Check params:
|
||||||
|
cLuaState S(L);
|
||||||
|
if (
|
||||||
|
!S.CheckParamUserTable(1, "cMojangAPI") ||
|
||||||
|
!S.CheckParamString(2) ||
|
||||||
|
!S.CheckParamEnd(3)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the params:
|
||||||
|
AString UUID;
|
||||||
|
S.GetStackValue(2, UUID);
|
||||||
|
|
||||||
|
// Push the result:
|
||||||
|
S.Push(cRoot::Get()->GetMojangAPI().MakeUUIDShort(UUID));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int Lua_ItemGrid_GetSlotCoords(lua_State * L)
|
static int Lua_ItemGrid_GetSlotCoords(lua_State * L)
|
||||||
{
|
{
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
@ -3355,6 +3411,8 @@ void ManualBindings::Bind(lua_State * tolua_S)
|
|||||||
tolua_function(tolua_S, "GetPlayerNameFromUUID", tolua_cMojangAPI_GetPlayerNameFromUUID);
|
tolua_function(tolua_S, "GetPlayerNameFromUUID", tolua_cMojangAPI_GetPlayerNameFromUUID);
|
||||||
tolua_function(tolua_S, "GetUUIDFromPlayerName", tolua_cMojangAPI_GetUUIDFromPlayerName);
|
tolua_function(tolua_S, "GetUUIDFromPlayerName", tolua_cMojangAPI_GetUUIDFromPlayerName);
|
||||||
tolua_function(tolua_S, "GetUUIDsFromPlayerNames", tolua_cMojangAPI_GetUUIDsFromPlayerNames);
|
tolua_function(tolua_S, "GetUUIDsFromPlayerNames", tolua_cMojangAPI_GetUUIDsFromPlayerNames);
|
||||||
|
tolua_function(tolua_S, "MakeUUIDDashed", tolua_cMojangAPI_MakeUUIDDashed);
|
||||||
|
tolua_function(tolua_S, "MakeUUIDShort", tolua_cMojangAPI_MakeUUIDShort);
|
||||||
tolua_endmodule(tolua_S);
|
tolua_endmodule(tolua_S);
|
||||||
|
|
||||||
tolua_beginmodule(tolua_S, "cItemGrid");
|
tolua_beginmodule(tolua_S, "cItemGrid");
|
||||||
|
@ -38,8 +38,6 @@ public:
|
|||||||
Returns true if all was successful, false on failure. */
|
Returns true if all was successful, false on failure. */
|
||||||
static bool SecureRequest(const AString & a_ServerName, const AString & a_Request, AString & a_Response);
|
static bool SecureRequest(const AString & a_ServerName, const AString & a_Request, AString & a_Response);
|
||||||
|
|
||||||
// tolua_begin
|
|
||||||
|
|
||||||
/** Normalizes the given UUID to its short form (32 bytes, no dashes, lowercase).
|
/** Normalizes the given UUID to its short form (32 bytes, no dashes, lowercase).
|
||||||
Logs a warning and returns empty string if not a UUID.
|
Logs a warning and returns empty string if not a UUID.
|
||||||
Note: only checks the string's length, not the actual content. */
|
Note: only checks the string's length, not the actual content. */
|
||||||
@ -50,8 +48,6 @@ public:
|
|||||||
Note: only checks the string's length, not the actual content. */
|
Note: only checks the string's length, not the actual content. */
|
||||||
static AString MakeUUIDDashed(const AString & a_UUID);
|
static AString MakeUUIDDashed(const AString & a_UUID);
|
||||||
|
|
||||||
// tolua_end
|
|
||||||
|
|
||||||
/** Converts a player name into a UUID.
|
/** Converts a player name into a UUID.
|
||||||
The UUID will be empty on error.
|
The UUID will be empty on error.
|
||||||
If a_UseOnlyCached is true, the function only consults the cached values.
|
If a_UseOnlyCached is true, the function only consults the cached values.
|
||||||
|
Loading…
Reference in New Issue
Block a user