Skip to content

lua_tinker::table_onstack::for_each_obj 当Table中其他元素也是table的时候,遍历完第一个循环终止了; #21

@HuShanjun

Description

@HuShanjun

static int test_table(lua_State* L){
lua_tinker::table_onstack t = lua_tinker::detail::read< lua_tinker::table_onstack>(L, 1);
t.for_each_obj<int, lua_tinker::table_onstack>([&t](const int& key, const lua_tinker::table_onstack& value){
SL_INFO("key = "<< key);
value.for_each_obj<int, int>([](int kk, int vv){
SL_INFO("key = "<< kk <<", val = "<< vv);
return true;
});
return true;
});
return 0;
}

当遍历完第一个table的第一个元素,lua_tinker::table_onstack析构,内部m_obj调用lua_remove导致lua栈被破坏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions