File tree Expand file tree Collapse file tree 3 files changed +9
-18
lines changed
src/LuaCEmbed/table/table/getters/index Expand file tree Collapse file tree 3 files changed +9
-18
lines changed Original file line number Diff line number Diff line change @@ -24211,15 +24211,13 @@ bool LuaCembedTable_has_key_at_index(LuaCEmbedTable *self, long index){
24211
24211
lua_pushnil(self->main_object->state);
24212
24212
while(lua_next(self->main_object->state,table_index)){
24213
24213
if(total == converted_index){
24214
- if(lua_type(self->main_object->state,-2) != LUA_CEMBED_STRING ){
24215
- return false;
24216
- }
24217
- return true;
24214
+ bool has_key =lua_type(self->main_object->state,-2) == LUA_CEMBED_STRING;
24215
+ lua_pop(self->main_object->state,1);
24216
+ return has_key;
24218
24217
}
24219
24218
24220
24219
lua_pop(self->main_object->state,1);
24221
24220
total+=1;
24222
-
24223
24221
}
24224
24222
24225
24223
return false;
@@ -24228,7 +24226,6 @@ bool LuaCembedTable_has_key_at_index(LuaCEmbedTable *self, long index){
24228
24226
long long LuaCEmbedTable_get_long_by_index(LuaCEmbedTable *self, int index){
24229
24227
PRIVATE_LUA_CEMBED_TABLE_PROTECT_NUM
24230
24228
private_lua_cembed_memory_limit = self->main_object->memory_limit;
24231
-
24232
24229
int formatted_index = index + LUA_CEMBED_INDEX_DIF;
24233
24230
24234
24231
lua_getglobal(self->main_object->state,self->global_name);
Original file line number Diff line number Diff line change @@ -106,15 +106,13 @@ bool LuaCembedTable_has_key_at_index(LuaCEmbedTable *self, long index){
106
106
lua_pushnil (self -> main_object -> state );
107
107
while (lua_next (self -> main_object -> state ,table_index )){
108
108
if (total == converted_index ){
109
- if (lua_type (self -> main_object -> state ,-2 ) != LUA_CEMBED_STRING ){
110
- return false;
111
- }
112
- return true;
109
+ bool has_key = lua_type (self -> main_object -> state ,-2 ) == LUA_CEMBED_STRING ;
110
+ lua_pop (self -> main_object -> state ,1 );
111
+ return has_key ;
113
112
}
114
113
115
114
lua_pop (self -> main_object -> state ,1 );
116
115
total += 1 ;
117
-
118
116
}
119
117
120
118
return false;
@@ -123,7 +121,6 @@ bool LuaCembedTable_has_key_at_index(LuaCEmbedTable *self, long index){
123
121
long long LuaCEmbedTable_get_long_by_index (LuaCEmbedTable * self , int index ){
124
122
PRIVATE_LUA_CEMBED_TABLE_PROTECT_NUM
125
123
private_lua_cembed_memory_limit = self -> main_object -> memory_limit ;
126
-
127
124
int formatted_index = index + LUA_CEMBED_INDEX_DIF ;
128
125
129
126
lua_getglobal (self -> main_object -> state ,self -> global_name );
Original file line number Diff line number Diff line change @@ -24211,15 +24211,13 @@ bool LuaCembedTable_has_key_at_index(LuaCEmbedTable *self, long index){
24211
24211
lua_pushnil(self->main_object->state);
24212
24212
while(lua_next(self->main_object->state,table_index)){
24213
24213
if(total == converted_index){
24214
- if(lua_type(self->main_object->state,-2) != LUA_CEMBED_STRING ){
24215
- return false;
24216
- }
24217
- return true;
24214
+ bool has_key =lua_type(self->main_object->state,-2) == LUA_CEMBED_STRING;
24215
+ lua_pop(self->main_object->state,1);
24216
+ return has_key;
24218
24217
}
24219
24218
24220
24219
lua_pop(self->main_object->state,1);
24221
24220
total+=1;
24222
-
24223
24221
}
24224
24222
24225
24223
return false;
@@ -24228,7 +24226,6 @@ bool LuaCembedTable_has_key_at_index(LuaCEmbedTable *self, long index){
24228
24226
long long LuaCEmbedTable_get_long_by_index(LuaCEmbedTable *self, int index){
24229
24227
PRIVATE_LUA_CEMBED_TABLE_PROTECT_NUM
24230
24228
private_lua_cembed_memory_limit = self->main_object->memory_limit;
24231
-
24232
24229
int formatted_index = index + LUA_CEMBED_INDEX_DIF;
24233
24230
24234
24231
lua_getglobal(self->main_object->state,self->global_name);
You can’t perform that action at this time.
0 commit comments