Move Lua index helpers to components and make owner.factiooRank match other ranks

This commit is contained in:
Evil Eye 2024-06-18 21:32:16 +02:00
parent 6653502567
commit d6fc0744c7
16 changed files with 75 additions and 56 deletions

20
components/lua/util.hpp Normal file
View file

@ -0,0 +1,20 @@
#ifndef COMPONENTS_LUA_UTIL_H
#define COMPONENTS_LUA_UTIL_H
#include <cstdint>
namespace LuaUtil
{
// Lua arrays index from 1
constexpr inline std::int64_t fromLuaIndex(std::int64_t i)
{
return i - 1;
}
constexpr inline std::int64_t toLuaIndex(std::int64_t i)
{
return i + 1;
}
}
#endif