Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion include/sol/stack_field.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,17 @@ namespace sol { namespace stack {
lua_getglobal(L, &key[0]);
}
else {
lua_getfield(L, tableindex, &key[0]);
if constexpr (std::is_same_v<std::decay_t<Key>, const char*>) {
// Handle const char* case
if (key != nullptr) {
lua_getfield(L, tableindex, key);
} else {
push(L, lua_nil);
}
} else {
// Handle std::string case
lua_getfield(L, tableindex, key.c_str());
}
}
}
else if constexpr (std::is_same_v<T, meta_function>) {
Expand Down
2 changes: 1 addition & 1 deletion include/sol/usertype_container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ namespace sol {
static int next_associative(std::true_type, lua_State* L_) {
iter& i = stack::unqualified_get<user<iter>>(L_, 1);
auto& it = i.it();
auto& end = i.end();
auto& end = i.sen();
if (it == end) {
return stack::push(L_, lua_nil);
}
Expand Down