Skip to content

Commit

Permalink
Small Lua fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pinguin999 committed Jun 30, 2024
1 parent 18965eb commit 246cfd0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void Game::setupLuaFunctions()
if (obj)
{
obj->setSkin(skin);
std::string lua_object = getLuaPath(object);
std::string lua_object = getLuaPath(obj->getId());
lua_state->script(lua_object + ".skin = \"" + skin + "\"");
}
});
Expand Down Expand Up @@ -489,7 +489,7 @@ void Game::setupLuaFunctions()
if (position)
{
obj->setPosition(position.value());
std::string lua_object = getLuaPath(object);
std::string lua_object = getLuaPath(obj->getId());
lua_state->script(lua_object + ".x = \"" + std::to_string(position->x) + "\"");
lua_state->script(lua_object + ".y = \"" + std::to_string(position->y) + "\"");
}
Expand All @@ -516,7 +516,7 @@ void Game::setupLuaFunctions()
if (obj && position)
{
obj->setPosition(frm->getPosition() + position.value());
std::string lua_object = getLuaPath(object);
std::string lua_object = getLuaPath(obj->getId());
lua_state->script(lua_object + ".x = \"" + std::to_string(frm->getPosition().x + position->x) + "\"");
lua_state->script(lua_object + ".y = \"" + std::to_string(frm->getPosition().y + position->y) + "\"");
}
Expand All @@ -542,7 +542,7 @@ void Game::setupLuaFunctions()
if (obj)
{
obj->setVisible(false);
std::string lua_object = getLuaPath(object);
std::string lua_object = getLuaPath(obj->getId());
lua_state->script(lua_object + ".visible = false");
}
});
Expand All @@ -566,7 +566,7 @@ void Game::setupLuaFunctions()
if (obj)
{
obj->setVisible(true);
std::string lua_object = getLuaPath(object);
std::string lua_object = getLuaPath(obj->getId());
lua_state->script(lua_object + ".visible = true");
}
});
Expand All @@ -592,7 +592,7 @@ void Game::setupLuaFunctions()
if (obj)
{
obj->layer = layer;
std::string lua_object = getLuaPath(object);
std::string lua_object = getLuaPath(obj->getId());
lua_state->script(lua_object + ".layer = " + std::to_string(layer));
}
});
Expand Down Expand Up @@ -745,6 +745,8 @@ void Game::setupLuaFunctions()
{
std::shared_ptr<SpineObject> obj = (*lua_state)["this"];
obj->setScale(scale);
std::string lua_object = getLuaPath(obj->getId());
lua_state->script(lua_object + ".scale = \"" + std::to_string(scale) + "\"");
});

/// See SetScale
Expand All @@ -757,6 +759,8 @@ void Game::setupLuaFunctions()
if (obj)
{
obj->setScale(scale);
std::string lua_object = getLuaPath(obj->getId());
lua_state->script(lua_object + ".scale = \"" + std::to_string(scale) + "\"");
}
});

Expand Down

0 comments on commit 246cfd0

Please sign in to comment.