Skip to content

Commit

Permalink
修复一处崩溃
Browse files Browse the repository at this point in the history
  • Loading branch information
xiyoo0812 committed Sep 25, 2023
1 parent 63489c4 commit b805440
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions extend/lualog/lualog/lualog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace logger {
}

template<size_t... integers>
int tformat(lua_State* L, log_level lvl, cstring& tag, cstring& feature, int flag, cstring& vfmt, std::index_sequence<integers...>&&) {
int tformat(lua_State* L, log_level lvl, cstring& tag, cstring& feature, int flag, vstring vfmt, std::index_sequence<integers...>&&) {
try {
auto msg = fmt::format(vfmt, read_args(L, flag, integers + 6)...);
return zformat(L, lvl, tag, feature, msg);
Expand Down Expand Up @@ -71,10 +71,10 @@ namespace logger {
size_t flag = lua_tointeger(L, 2);
sstring tag = lua_to_native<sstring>(L, 3);
sstring feature = lua_to_native<sstring>(L, 4);
sstring vfmt = lua_to_native<sstring>(L, 5);
vstring vfmt = lua_to_native<vstring>(L, 5);
int arg_num = lua_gettop(L) - 5;
switch (arg_num) {
case 0: return zformat(L, lvl, tag, feature, vfmt);
case 0: return zformat(L, lvl, tag, feature, string(vfmt.data(), vfmt.size()));
case 1: return tformat(L, lvl, tag, feature, flag, vfmt, make_index_sequence<1>{});
case 2: return tformat(L, lvl, tag, feature, flag, vfmt, make_index_sequence<2>{});
case 3: return tformat(L, lvl, tag, feature, flag, vfmt, make_index_sequence<3>{});
Expand Down

0 comments on commit b805440

Please sign in to comment.