File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -139,16 +139,15 @@ namespace luadebug::table {
139139
140140 bool get_array (lua_State* L, const void * tv, unsigned int i) {
141141#if LUA_VERSION_NUM >= 505
142- Table* t = (Table*)tv;
143- unsigned k = (i - 1 < t->asize ) ? i : 0 ;
144- if (k == 0 ) {
142+ Table* t = (Table*)tv;
143+ if (i >= t->asize ) {
145144 return false ;
146145 }
147- lu_byte tag = *getArrTag (t, k - 1 );
146+ lu_byte tag = *getArrTag (t, i );
148147 if (tagisempty (tag)) {
149148 return false ;
150149 }
151- farr2val (t, k - 1 , tag, s2v (LUA_STKID (L->top )));
150+ farr2val (t, i , tag, s2v (LUA_STKID (L->top )));
152151 LUA_STKID (L->top ) += 1 ;
153152 return true ;
154153#else
@@ -166,11 +165,10 @@ namespace luadebug::table {
166165 bool set_array (lua_State* L, const void * tv, unsigned int i) {
167166#if LUA_VERSION_NUM >= 505
168167 Table* t = (Table*)tv;
169- unsigned k = (i - 1 < t->asize ) ? i : 0 ;
170- if (k == 0 ) {
168+ if (i >= t->asize ) {
171169 return false ;
172170 }
173- obj2arr (t, k - 1 , s2v (LUA_STKID (L->top ) - 1 ));
171+ obj2arr (t, i , s2v (LUA_STKID (L->top ) - 1 ));
174172 LUA_STKID (L->top ) -= 1 ;
175173 return true ;
176174#else
You can’t perform that action at this time.
0 commit comments