Skip to content

Commit

Permalink
Merge pull request #648 from UE4SS-RE/FixClangCompile
Browse files Browse the repository at this point in the history
  • Loading branch information
narknon authored Sep 5, 2024
2 parents 570c770 + 2ab19d2 commit d79b488
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 47 deletions.
4 changes: 2 additions & 2 deletions deps/first/JSON/include/JSON/String.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ namespace RC::JSON
}

public:
RC_JSON_API JSON_DEPRECATED auto serialize(ShouldFormat should_format = ShouldFormat::No, int32_t* indent_level = nullptr) -> StringType override;
RC_JSON_API JSON_DEPRECATED auto get_type() const -> Type override
JSON_DEPRECATED RC_JSON_API auto serialize(ShouldFormat should_format = ShouldFormat::No, int32_t* indent_level = nullptr) -> StringType override;
JSON_DEPRECATED RC_JSON_API auto get_type() const -> Type override
{
return Type::String;
}
Expand Down
55 changes: 11 additions & 44 deletions deps/first/LuaMadeSimple/include/LuaMadeSimple/LuaMadeSimple.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,55 +32,22 @@ namespace RC::LuaMadeSimple
{
const class Lua* lua{};

[[nodiscard]] auto is_nil() -> bool
{
return lua_isnil(lua->get_lua_state(), StackIndex);
}
[[nodiscard]] auto is_nil() -> bool;

[[nodiscard]] auto is_string() const -> bool
{
return lua_type(lua->get_lua_state(), StackIndex) == LUA_TSTRING;
}
[[nodiscard]] auto get_string() const -> std::string_view
{
return lua_tostring(lua->get_lua_state(), StackIndex);
}
[[nodiscard]] auto is_string() const -> bool;
[[nodiscard]] auto get_string() const -> std::string_view;

[[nodiscard]] auto is_number() const -> bool
{
return lua_isnumber(lua->get_lua_state(), StackIndex);
}
[[nodiscard]] auto get_number() const -> double
{
return lua_tonumber(lua->get_lua_state(), StackIndex);
}
[[nodiscard]] auto get_float(int32_t force_index = 1) -> float // Safe to use after a call to is_number
{
return static_cast<float>(lua_tonumber(lua->get_lua_state(), force_index));
}
[[nodiscard]] auto is_number() const -> bool;
[[nodiscard]] auto get_number() const -> double;
[[nodiscard]] auto get_float(int32_t force_index = 1) -> float; // Safe to use after a call to is_number

[[nodiscard]] auto is_integer() const -> bool
{
return lua_isinteger(lua->get_lua_state(), StackIndex);
}
[[nodiscard]] auto get_integer() const -> int64_t
{
return lua_tointeger(lua->get_lua_state(), StackIndex);
}
[[nodiscard]] auto is_integer() const -> bool;
[[nodiscard]] auto get_integer() const -> int64_t;

[[nodiscard]] auto is_bool() const -> bool
{
return lua_isboolean(lua->get_lua_state(), StackIndex);
}
[[nodiscard]] auto get_bool() const -> bool
{
return lua_toboolean(lua->get_lua_state(), StackIndex);
}
[[nodiscard]] auto is_bool() const -> bool;
[[nodiscard]] auto get_bool() const -> bool;

[[nodiscard]] auto is_table() const -> bool
{
return lua_istable(lua->get_lua_state(), StackIndex);
}
[[nodiscard]] auto is_table() const -> bool;
};

/**
Expand Down
112 changes: 112 additions & 0 deletions deps/first/LuaMadeSimple/src/LuaMadeSimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,118 @@ namespace RC::LuaMadeSimple
// Current errors for all lua states
static std::unordered_map<lua_State*, std::string> lua_state_errors;

template <>
auto LuaTableData<-1>::is_nil() -> bool
{
return lua_isnil(lua->get_lua_state(), -1);
}
template <>
auto LuaTableData<-1>::is_string() const -> bool
{
return lua_type(lua->get_lua_state(), -1) == LUA_TSTRING;
}
template <>
auto LuaTableData<-1>::get_string() const -> std::string_view
{
return lua_tostring(lua->get_lua_state(), -1);
}
template <>
auto LuaTableData<-1>::is_number() const -> bool
{
return lua_isnumber(lua->get_lua_state(), -1);
}
template <>
auto LuaTableData<-1>::get_number() const -> double
{
return lua_tonumber(lua->get_lua_state(), -1);
}
template <>
auto LuaTableData<-1>::get_float(int32_t force_index) -> float // Safe to use after a call to is_number
{
return static_cast<float>(lua_tonumber(lua->get_lua_state(), force_index));
}
template <>
auto LuaTableData<-1>::is_integer() const -> bool
{
return lua_isinteger(lua->get_lua_state(), -1);
}
template <>
auto LuaTableData<-1>::get_integer() const -> int64_t
{
return lua_tointeger(lua->get_lua_state(), -1);
}
template <>
auto LuaTableData<-1>::is_bool() const -> bool
{
return lua_isboolean(lua->get_lua_state(), -1);
}
template <>
auto LuaTableData<-1>::get_bool() const -> bool
{
return lua_toboolean(lua->get_lua_state(), -1);
}
template <>
auto LuaTableData<-1>::is_table() const -> bool
{
return lua_istable(lua->get_lua_state(), -1);
}

template <>
auto LuaTableData<-2>::is_nil() -> bool
{
return lua_isnil(lua->get_lua_state(), -2);
}
template <>
auto LuaTableData<-2>::is_string() const -> bool
{
return lua_type(lua->get_lua_state(), -2) == LUA_TSTRING;
}
template <>
auto LuaTableData<-2>::get_string() const -> std::string_view
{
return lua_tostring(lua->get_lua_state(), -2);
}
template <>
auto LuaTableData<-2>::is_number() const -> bool
{
return lua_isnumber(lua->get_lua_state(), -2);
}
template <>
auto LuaTableData<-2>::get_number() const -> double
{
return lua_tonumber(lua->get_lua_state(), -2);
}
template <>
auto LuaTableData<-2>::get_float(int32_t force_index) -> float // Safe to use after a call to is_number
{
return static_cast<float>(lua_tonumber(lua->get_lua_state(), force_index));
}
template <>
auto LuaTableData<-2>::is_integer() const -> bool
{
return lua_isinteger(lua->get_lua_state(), -2);
}
template <>
auto LuaTableData<-2>::get_integer() const -> int64_t
{
return lua_tointeger(lua->get_lua_state(), -2);
}
template <>
auto LuaTableData<-2>::is_bool() const -> bool
{
return lua_isboolean(lua->get_lua_state(), -2);
}
template <>
auto LuaTableData<-2>::get_bool() const -> bool
{
return lua_toboolean(lua->get_lua_state(), -2);
}
template <>
auto LuaTableData<-2>::is_table() const -> bool
{
return lua_istable(lua->get_lua_state(), -2);
}

Lua::Lua(lua_State* lua_state) : m_lua_state(lua_state), m_registry(*this)
{
}
Expand Down
2 changes: 1 addition & 1 deletion deps/first/Unreal

0 comments on commit d79b488

Please sign in to comment.