aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compat.h10
-rw-r--r--src/linda.cpp4
2 files changed, 7 insertions, 7 deletions
diff --git a/src/compat.h b/src/compat.h
index 2690a41..8b3eb98 100644
--- a/src/compat.h
+++ b/src/compat.h
@@ -184,9 +184,9 @@ concept RequiresOldLuaGetfield = requires(LUA_GETFIELD f_)
184}; 184};
185 185
186template <RequiresOldLuaGetfield LUA_GETFIELD> 186template <RequiresOldLuaGetfield LUA_GETFIELD>
187static inline int WrapLuaGetField(LUA_GETFIELD f_, lua_State* const L_, int const idx_, char const* const name_) 187static inline int WrapLuaGetField(LUA_GETFIELD f_, lua_State* const L_, int const idx_, std::string_view const& name_)
188{ 188{
189 f_(L_, idx_, name_); 189 f_(L_, idx_, name_.data());
190 return lua_type(L_, -1); 190 return lua_type(L_, -1);
191} 191}
192 192
@@ -201,16 +201,16 @@ concept RequiresNewLuaGetfield = requires(LUA_GETFIELD f_)
201}; 201};
202 202
203template <RequiresNewLuaGetfield LUA_GETFIELD> 203template <RequiresNewLuaGetfield LUA_GETFIELD>
204static inline int WrapLuaGetField(LUA_GETFIELD f_, lua_State* const L_, int const idx_, char const* const name_) 204static inline int WrapLuaGetField(LUA_GETFIELD f_, lua_State* const L_, int const idx_, std::string_view const& name_)
205{ 205{
206 return f_(L_, idx_, name_); 206 return f_(L_, idx_, name_.data());
207} 207}
208 208
209// ------------------------------------------------------------------------------------------------- 209// -------------------------------------------------------------------------------------------------
210 210
211static inline LuaType luaG_getfield(lua_State* const L_, int const idx_, std::string_view const& name_) 211static inline LuaType luaG_getfield(lua_State* const L_, int const idx_, std::string_view const& name_)
212{ 212{
213 return static_cast<LuaType>(WrapLuaGetField(lua_getfield, L_, idx_, name_.data())); 213 return static_cast<LuaType>(WrapLuaGetField(lua_getfield, L_, idx_, name_));
214} 214}
215 215
216// ################################################################################################# 216// #################################################################################################
diff --git a/src/linda.cpp b/src/linda.cpp
index 13627aa..43fcd20 100644
--- a/src/linda.cpp
+++ b/src/linda.cpp
@@ -180,8 +180,8 @@ std::string_view Linda::getName() const
180 return _name; 180 return _name;
181 } 181 }
182 if (std::holds_alternative<EmbeddedName>(nameVariant)) { 182 if (std::holds_alternative<EmbeddedName>(nameVariant)) {
183 char const* const _name{ std::get<EmbeddedName>(nameVariant).data() }; 183 EmbeddedName const& _name = std::get<EmbeddedName>(nameVariant);
184 return std::string_view{ _name }; 184 return std::string_view{ _name.data() };
185 } 185 }
186 return std::string_view{}; 186 return std::string_view{};
187} 187}