britzl / extension-imgui

Dear ImGUI extension for Defold
MIT License
58 stars 19 forks source link

BeginTable Flags cause error #48

Closed zendorx closed 5 months ago

zendorx commented 5 months ago

I could not figure out how to use flags for table. It is crushing app. I tried to add flags in cpp code, but it cause same error

"Assertion failed: (table != __null && "Need to call TableSetupColumn() after BeginTable()!"), function TableSetupColumn, file imgui_tables.cpp, line 1355."

To reproduce error add flag like that

imgui.begin_table("table_example", 3, imgui.TABLE_SCROLLX)

Also I added outer_size vector in cpp code like that (for test). But error remains.

static int imgui_BeginTable(lua_State* L)
{
    DM_LUA_STACK_CHECK(L, 1);
    imgui_NewFrame();
    const char* id = luaL_checkstring(L, 1);
    int column = luaL_checkinteger(L, 2);
    uint32_t flags = 0;
    if (lua_isnumber(L, 3))
    {
        flags = luaL_checkint(L, 3);
    }

    ImVec2 outer_size = ImVec2(0.0f, 100);
    bool result = ImGui::BeginTable(id, column, flags, outer_size);
    lua_pushboolean(L, result);
    return 1;
}