Skip to content
This repository has been archived by the owner on Nov 19, 2022. It is now read-only.

Add StringToSHA256 #27

Merged
merged 3 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/Defs/Alt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ namespace lua::Class

lua_globalfunction(L, "export", Export);
lua_globalfunction(L, "hash", Hash);
lua_globalfunction(L, "hashSHA256", StringToSHA256);
lua_globalfunction(L, "isDebug", IsDebug);
lua_globalfunction(L, "fileExists", FileExists);
lua_globalfunction(L, "fileRead", FileRead);
Expand Down Expand Up @@ -1984,6 +1985,24 @@ namespace lua::Class
return 1;
}

int Alt::StringToSHA256(lua_State* L)
{
std::string hashKey;

ArgumentReader argReader(L);
argReader.ReadString(hashKey);

if (argReader.HasAnyError())
{
argReader.GetErrorMessages();
return 0;
}

lua_pushstring(L, Core->StringToSHA256(hashKey));

return 1;
}

int Alt::OnServer(lua_State* L)
{
std::string eventName;
Expand Down
1 change: 1 addition & 0 deletions src/Defs/Alt.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ namespace lua::Class
static int GetBranch(lua_State* L);

static int Hash(lua_State* L);
static int StringToSHA256(lua_State* L);

static int GetModuleTime(lua_State* L);

Expand Down
2 changes: 1 addition & 1 deletion vendors/cpp-sdk