From 7da879317256b70707c5f6d98a965e8f5c7dc112 Mon Sep 17 00:00:00 2001 From: lethosor Date: Mon, 9 Apr 2018 16:11:47 -0400 Subject: [PATCH] Set last_item_value properly for complex enums --- library/DataDefs.cpp | 1 + library/LuaWrapper.cpp | 6 ++++++ library/xml | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/library/DataDefs.cpp b/library/DataDefs.cpp index ce97904ad..3d802638f 100644 --- a/library/DataDefs.cpp +++ b/library/DataDefs.cpp @@ -152,6 +152,7 @@ enum_identity::enum_identity(size_t size, { if (complex) { count = complex->size(); + last_item_value = complex->index_value_map.back(); } else { count = int(last_item_value-first_item_value+1); diff --git a/library/LuaWrapper.cpp b/library/LuaWrapper.cpp index 1a079a8a4..a32e9263c 100644 --- a/library/LuaWrapper.cpp +++ b/library/LuaWrapper.cpp @@ -1451,6 +1451,12 @@ static void FillEnumKeys(lua_State *state, int ix_meta, int ftable, enum_identit lua_pushlightuserdata(state, (void*)complex); lua_pushcclosure(state, complex_enum_ipairs, 2); lua_setfield(state, ix_meta, "__ipairs"); + + lua_pushinteger(state, eid->getFirstItem()); + lua_setfield(state, ftable, "_first_item"); + + lua_pushinteger(state, eid->getLastItem()); + lua_setfield(state, ftable, "_last_item"); } else { diff --git a/library/xml b/library/xml index d3491fa87..028c4a303 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit d3491fa8790469e5325cf3f1ef1bf064b8011248 +Subproject commit 028c4a3031d828122d7ad4efdbc0522251542891