Skip to content

Commit

Permalink
imgui: reuse existing lua string if input text isn't changed
Browse files Browse the repository at this point in the history
fix #175
  • Loading branch information
alexey-lysiuk committed Jan 14, 2024
1 parent fb5d5c9 commit 12e5e41
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Quake/imgui_lua_bindings/imgui_lua_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ static ImVector<char> ioTextBuffer;

#define IOTEXT_ARG(name) \
size_t i_##name##_size; \
const int bufferIndex = arg; \
const char * i_##name##_const = luaL_checklstring(L, arg++, &(i_##name##_size)); \
const lua_Integer bufferSizeInt = luaL_checkinteger(L, arg); \
static constexpr lua_Integer BUFFER_SIZE_MIN = 1024; \
Expand All @@ -96,7 +97,10 @@ static ImVector<char> ioTextBuffer;

#define END_IOTEXT(name) \
const char* o_##name = name;\
lua_pushstring(L, o_##name); \
if (ret) \
lua_pushstring(L, o_##name); \
else \
lua_pushvalue(L, bufferIndex); \
stackval++;

#define IM_VEC_2_ARG(name)\
Expand Down

0 comments on commit 12e5e41

Please sign in to comment.