Skip to content

Commit

Permalink
allow cpp to create a float lua global
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Aug 25, 2023
1 parent 14a84db commit 915094c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Etterna/Singletons/LuaManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@ LuaManager::SetGlobal(const std::string& sName, const std::string& val)
Release(L);
}

void
LuaManager::SetGlobal(const std::string& sName, float val)
{
Lua* L = Get();
LuaHelpers::Push(L, val);
lua_setglobal(L, sName.c_str());
Release(L);
}

void
LuaManager::UnsetGlobal(const std::string& sName)
{
Expand Down
1 change: 1 addition & 0 deletions src/Etterna/Singletons/LuaManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class LuaManager
void RegisterTypes();

void SetGlobal(const std::string& sName, int val);
void SetGlobal(const std::string& sName, float val);
void SetGlobal(const std::string& sName, const std::string& val);
void UnsetGlobal(const std::string& sName);

Expand Down

0 comments on commit 915094c

Please sign in to comment.