diff options
Diffstat (limited to 'src/compat.h')
-rw-r--r-- | src/compat.h | 10 |
1 files changed, 5 insertions, 5 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 | ||
186 | template <RequiresOldLuaGetfield LUA_GETFIELD> | 186 | template <RequiresOldLuaGetfield LUA_GETFIELD> |
187 | static inline int WrapLuaGetField(LUA_GETFIELD f_, lua_State* const L_, int const idx_, char const* const name_) | 187 | static 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 | ||
203 | template <RequiresNewLuaGetfield LUA_GETFIELD> | 203 | template <RequiresNewLuaGetfield LUA_GETFIELD> |
204 | static inline int WrapLuaGetField(LUA_GETFIELD f_, lua_State* const L_, int const idx_, char const* const name_) | 204 | static 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 | ||
211 | static inline LuaType luaG_getfield(lua_State* const L_, int const idx_, std::string_view const& name_) | 211 | static 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 | // ################################################################################################# |