aboutsummaryrefslogtreecommitdiff
path: root/src/compat.h
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-09-24 10:33:34 +0200
committerBenoit Germain <benoit.germain@ubisoft.com>2024-09-24 10:33:34 +0200
commit1a0893dc9b3d003683c9db9866da13effb3592e3 (patch)
tree9989a72f1a30c1e320683075bdaa1ad025a74c1a /src/compat.h
parente1af4f31a1916a18d6ee0744bd91c1ee9d8651f4 (diff)
downloadlanes-1a0893dc9b3d003683c9db9866da13effb3592e3.tar.gz
lanes-1a0893dc9b3d003683c9db9866da13effb3592e3.tar.bz2
lanes-1a0893dc9b3d003683c9db9866da13effb3592e3.zip
less char const* in the code
Diffstat (limited to 'src/compat.h')
-rw-r--r--src/compat.h10
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
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// #################################################################################################