Skip to content

Commit 7f43759

Browse files
at
1 parent 1f9dea0 commit 7f43759

File tree

7 files changed

+117
-0
lines changed

7 files changed

+117
-0
lines changed

LuaCEmbed.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24323,6 +24323,8 @@ void LuaCEmbedTable_set_string_by_index(LuaCEmbedTable *self, long index, const
2432324323
lua_pushnumber(self->main_object->state,(double)formatted_index);
2432424324
lua_pushstring(self->main_object->state,value);
2432524325
lua_settable(self->main_object->state,-3);
24326+
lua_settop(self->main_object->state, 0);
24327+
2432624328
}
2432724329

2432824330
void LuaCEmbedTable_set_long_by_index(LuaCEmbedTable *self, long index, long value){
@@ -24339,6 +24341,8 @@ void LuaCEmbedTable_set_long_by_index(LuaCEmbedTable *self, long index, long v
2433924341
lua_pushnumber(self->main_object->state,(double)formatted_index);
2434024342
lua_pushnumber(self->main_object->state,(double )value);
2434124343
lua_settable(self->main_object->state,-3);
24344+
lua_settop(self->main_object->state, 0);
24345+
2434224346
}
2434324347

2434424348
void LuaCEmbedTable_set_double_by_index(LuaCEmbedTable *self, long index, double value){
@@ -24356,6 +24360,8 @@ void LuaCEmbedTable_set_double_by_index(LuaCEmbedTable *self, long index, doubl
2435624360
lua_pushnumber(self->main_object->state,(double)formatted_index);
2435724361
lua_pushnumber(self->main_object->state,(double )value);
2435824362
lua_settable(self->main_object->state,-3);
24363+
lua_settop(self->main_object->state, 0);
24364+
2435924365
}
2436024366

2436124367
void LuaCEmbedTable_set_bool_by_index(LuaCEmbedTable *self, long index, bool value){
@@ -24373,6 +24379,8 @@ void LuaCEmbedTable_set_bool_by_index(LuaCEmbedTable *self, long index, bool va
2437324379
lua_pushnumber(self->main_object->state,(double)formatted_index);
2437424380
lua_pushboolean(self->main_object->state,value);
2437524381
lua_settable(self->main_object->state,-3);
24382+
lua_settop(self->main_object->state, 0);
24383+
2437624384
}
2437724385

2437824386

@@ -24399,6 +24407,8 @@ void LuaCEmbedTable_set_evaluation_by_index(LuaCEmbedTable *self, long index, c
2439924407
lua_pushnumber(self->main_object->state,(double)formatted_index);
2440024408
lua_getglobal(self->main_object->state,PRIVATE_LUA_CEMBED_EVALUATION_NAME);
2440124409
lua_settable(self->main_object->state,-3);
24410+
lua_settop(self->main_object->state, 0);
24411+
2440224412
}
2440324413

2440424414

@@ -24457,6 +24467,7 @@ void LuaCEmbedTable_set_method(LuaCEmbedTable *self , const char *name, LuaCEmbe
2445724467
lua_getmetatable(self->main_object->state,-1);
2445824468
lua_setmetatable(self->main_object->state,-2);
2445924469
}
24470+
lua_settop(self->main_object->state, 0);
2446024471

2446124472
}
2446224473

@@ -24469,6 +24480,8 @@ void LuaCEmbedTable_set_string_prop(LuaCEmbedTable *self , const char *name, co
2446924480
lua_pushstring(self->main_object->state,value);
2447024481

2447124482
lua_settable(self->main_object->state,-3);
24483+
lua_settop(self->main_object->state, 0);
24484+
2447224485
}
2447324486

2447424487
void LuaCEmbedTable_set_long_prop(LuaCEmbedTable *self , const char *name, long value){
@@ -24478,6 +24491,8 @@ void LuaCEmbedTable_set_long_prop(LuaCEmbedTable *self , const char *name, long
2447824491
lua_pushstring(self->main_object->state,name);
2447924492
lua_pushnumber(self->main_object->state,(double)value);
2448024493
lua_settable(self->main_object->state,-3);
24494+
lua_settop(self->main_object->state, 0);
24495+
2448124496
}
2448224497

2448324498
void LuaCEmbedTable_set_double_prop(LuaCEmbedTable *self , const char *name, double value){
@@ -24488,6 +24503,8 @@ void LuaCEmbedTable_set_double_prop(LuaCEmbedTable *self , const char *name, do
2448824503
lua_pushstring(self->main_object->state,name);
2448924504
lua_pushnumber(self->main_object->state,value);
2449024505
lua_settable(self->main_object->state,-3);
24506+
lua_settop(self->main_object->state, 0);
24507+
2449124508
}
2449224509

2449324510
void LuaCEmbedTable_set_bool_prop(LuaCEmbedTable *self , const char *name, bool value){
@@ -24498,6 +24515,8 @@ void LuaCEmbedTable_set_bool_prop(LuaCEmbedTable *self , const char *name, bool
2449824515
lua_pushstring(self->main_object->state,name);
2449924516
lua_pushboolean(self->main_object->state,value);
2450024517
lua_settable(self->main_object->state,-3);
24518+
lua_settop(self->main_object->state, 0);
24519+
2450124520
}
2450224521

2450324522
void LuaCEmbedTable_set_evaluation_prop(LuaCEmbedTable *self, const char *name, const char *code, ...){
@@ -24523,6 +24542,8 @@ void LuaCEmbedTable_set_evaluation_prop(LuaCEmbedTable *self, const char *name,
2452324542
lua_pushstring(self->main_object->state,name);
2452424543
lua_getglobal(self->main_object->state,PRIVATE_LUA_CEMBED_EVALUATION_NAME);
2452524544
lua_settable(self->main_object->state,-3);
24545+
lua_settop(self->main_object->state, 0);
24546+
2452624547
}
2452724548

2452824549

@@ -24698,6 +24719,7 @@ LuaCEmbedTable *LuaCEmbedTable_new_sub_table_appending(LuaCEmbedTable *self){
2469824719
lua_pushinteger(self->main_object->state,index);
2469924720
lua_getglobal(self->main_object->state,full_sub_table_name);
2470024721
lua_settable(self->main_object->state,-3);
24722+
lua_settop(self->main_object->state, 0);
2470124723

2470224724
LuaCEmbedTable *possible = privateLuaCEmbedTableArray_find_by_internal_index(
2470324725
(privateLuaCEmbedTableArray *) self->sub_tables,
@@ -24802,6 +24824,8 @@ void LuaCEmbedTable_set_sub_table_by_index(LuaCEmbedTable *self, long index,LuaC
2480224824
lua_pushinteger(self->main_object->state,formatted_index);
2480324825
lua_getglobal(self->main_object->state,sub_table->global_name);
2480424826
lua_settable(self->main_object->state,-3);
24827+
lua_settop(self->main_object->state, 0);
24828+
2480524829
}
2480624830

2480724831

@@ -24815,6 +24839,8 @@ void LuaCEmbedTable_append_table(LuaCEmbedTable *self, LuaCEmbedTable *table){
2481524839
lua_pushinteger(self->main_object->state,size+1);
2481624840
lua_getglobal(self->main_object->state,table->global_name);
2481724841
lua_rawset(self->main_object->state,-3);
24842+
lua_settop(self->main_object->state, 0);
24843+
2481824844
}
2481924845

2482024846
void LuaCEmbedTable_append_string(LuaCEmbedTable *self, const char *value){
@@ -24826,6 +24852,8 @@ void LuaCEmbedTable_append_string(LuaCEmbedTable *self, const char *value){
2482624852
lua_pushinteger(self->main_object->state,size+1);
2482724853
lua_pushstring(self->main_object->state,value);
2482824854
lua_rawset(self->main_object->state,-3);
24855+
lua_settop(self->main_object->state, 0);
24856+
2482924857
}
2483024858

2483124859
void LuaCEmbedTable_append_long(LuaCEmbedTable *self, long value){
@@ -24837,6 +24865,8 @@ void LuaCEmbedTable_append_long(LuaCEmbedTable *self, long value){
2483724865
lua_pushinteger(self->main_object->state,size+1);
2483824866
lua_pushnumber(self->main_object->state,(double)value);
2483924867
lua_rawset(self->main_object->state,-3);
24868+
lua_settop(self->main_object->state, 0);
24869+
2484024870
}
2484124871

2484224872
void LuaCEmbedTable_append_double(LuaCEmbedTable *self, double value){
@@ -24848,6 +24878,8 @@ void LuaCEmbedTable_append_double(LuaCEmbedTable *self, double value){
2484824878
lua_pushinteger(self->main_object->state,size+1);
2484924879
lua_pushnumber(self->main_object->state,value);
2485024880
lua_rawset(self->main_object->state,-3);
24881+
lua_settop(self->main_object->state, 0);
24882+
2485124883
}
2485224884

2485324885
void LuaCEmbedTable_append_bool(LuaCEmbedTable *self, bool value){
@@ -24859,6 +24891,8 @@ void LuaCEmbedTable_append_bool(LuaCEmbedTable *self, bool value){
2485924891
lua_pushinteger(self->main_object->state,size+1);
2486024892
lua_pushboolean(self->main_object->state,value);
2486124893
lua_rawset(self->main_object->state,-3);
24894+
lua_settop(self->main_object->state, 0);
24895+
2486224896
}
2486324897

2486424898
void LuaCEmbedTable_append_evaluation(LuaCEmbedTable *self, const char *code, ...){
@@ -24885,6 +24919,7 @@ void LuaCEmbedTable_append_evaluation(LuaCEmbedTable *self, const char *code, .
2488524919
lua_pushinteger(self->main_object->state,size+1);
2488624920
lua_getglobal(self->main_object->state,PRIVATE_LUA_CEMBED_EVALUATION_NAME);
2488724921
lua_rawset(self->main_object->state,-3);
24922+
lua_settop(self->main_object->state, 0);
2488824923
}
2488924924

2489024925

@@ -25227,6 +25262,8 @@ int privateLuaCEmbed_main_callback_handler(lua_State *L){
2522725262
}
2522825263

2522925264
privateLuaCEmbedTableArray_free((privateLuaCEmbedTableArray*)self->func_tables);
25265+
lua_settop(self->state, 0);
25266+
2523025267
self->current_function = NULL;
2523125268

2523225269
if(!possible_return){
@@ -25345,6 +25382,7 @@ void private_LuaCEmbed_add_lib_callback(LuaCEmbed *self, const char *callback_na
2534525382
lua_setglobal(self->state, callback_name);
2534625383
}
2534725384

25385+
lua_settop(self->state, 0);
2534825386

2534925387
}
2535025388

@@ -25360,6 +25398,7 @@ void private_LuaCEmbed_add_evaluation_callback(LuaCEmbed *self, const char *call
2536025398

2536125399
lua_pushcclosure(self->state,privateLuaCEmbed_main_callback_handler,4);
2536225400
lua_setglobal(self->state, callback_name);
25401+
lua_settop(self->state, 0);
2536325402

2536425403
}
2536525404

src/LuaCEmbed/callback_handle/callback_handle.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ int privateLuaCEmbed_main_callback_handler(lua_State *L){
3232
}
3333

3434
privateLuaCEmbedTableArray_free((privateLuaCEmbedTableArray*)self->func_tables);
35+
lua_settop(self->state, 0);
36+
3537
self->current_function = NULL;
3638

3739
if(!possible_return){
@@ -150,6 +152,7 @@ void private_LuaCEmbed_add_lib_callback(LuaCEmbed *self, const char *callback_na
150152
lua_setglobal(self->state, callback_name);
151153
}
152154

155+
lua_settop(self->state, 0);
153156

154157
}
155158

@@ -165,6 +168,7 @@ void private_LuaCEmbed_add_evaluation_callback(LuaCEmbed *self, const char *call
165168

166169
lua_pushcclosure(self->state,privateLuaCEmbed_main_callback_handler,4);
167170
lua_setglobal(self->state, callback_name);
171+
lua_settop(self->state, 0);
168172

169173
}
170174

src/LuaCEmbed/table/table/append/append.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ void LuaCEmbedTable_append_table(LuaCEmbedTable *self, LuaCEmbedTable *table){
77
lua_pushinteger(self->main_object->state,size+1);
88
lua_getglobal(self->main_object->state,table->global_name);
99
lua_rawset(self->main_object->state,-3);
10+
lua_settop(self->main_object->state, 0);
11+
1012
}
1113

1214
void LuaCEmbedTable_append_string(LuaCEmbedTable *self, const char *value){
@@ -18,6 +20,8 @@ void LuaCEmbedTable_append_string(LuaCEmbedTable *self, const char *value){
1820
lua_pushinteger(self->main_object->state,size+1);
1921
lua_pushstring(self->main_object->state,value);
2022
lua_rawset(self->main_object->state,-3);
23+
lua_settop(self->main_object->state, 0);
24+
2125
}
2226

2327
void LuaCEmbedTable_append_long(LuaCEmbedTable *self, long value){
@@ -29,6 +33,8 @@ void LuaCEmbedTable_append_long(LuaCEmbedTable *self, long value){
2933
lua_pushinteger(self->main_object->state,size+1);
3034
lua_pushnumber(self->main_object->state,(double)value);
3135
lua_rawset(self->main_object->state,-3);
36+
lua_settop(self->main_object->state, 0);
37+
3238
}
3339

3440
void LuaCEmbedTable_append_double(LuaCEmbedTable *self, double value){
@@ -40,6 +46,8 @@ void LuaCEmbedTable_append_double(LuaCEmbedTable *self, double value){
4046
lua_pushinteger(self->main_object->state,size+1);
4147
lua_pushnumber(self->main_object->state,value);
4248
lua_rawset(self->main_object->state,-3);
49+
lua_settop(self->main_object->state, 0);
50+
4351
}
4452

4553
void LuaCEmbedTable_append_bool(LuaCEmbedTable *self, bool value){
@@ -51,6 +59,8 @@ void LuaCEmbedTable_append_bool(LuaCEmbedTable *self, bool value){
5159
lua_pushinteger(self->main_object->state,size+1);
5260
lua_pushboolean(self->main_object->state,value);
5361
lua_rawset(self->main_object->state,-3);
62+
lua_settop(self->main_object->state, 0);
63+
5464
}
5565

5666
void LuaCEmbedTable_append_evaluation(LuaCEmbedTable *self, const char *code, ...){
@@ -77,4 +87,5 @@ void LuaCEmbedTable_append_evaluation(LuaCEmbedTable *self, const char *code, .
7787
lua_pushinteger(self->main_object->state,size+1);
7888
lua_getglobal(self->main_object->state,PRIVATE_LUA_CEMBED_EVALUATION_NAME);
7989
lua_rawset(self->main_object->state,-3);
90+
lua_settop(self->main_object->state, 0);
8091
}

src/LuaCEmbed/table/table/setters/index/index.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ void LuaCEmbedTable_set_string_by_index(LuaCEmbedTable *self, long index, const
1414
lua_pushnumber(self->main_object->state,(double)formatted_index);
1515
lua_pushstring(self->main_object->state,value);
1616
lua_settable(self->main_object->state,-3);
17+
lua_settop(self->main_object->state, 0);
18+
1719
}
1820

1921
void LuaCEmbedTable_set_long_by_index(LuaCEmbedTable *self, long index, long value){
@@ -30,6 +32,8 @@ void LuaCEmbedTable_set_long_by_index(LuaCEmbedTable *self, long index, long v
3032
lua_pushnumber(self->main_object->state,(double)formatted_index);
3133
lua_pushnumber(self->main_object->state,(double )value);
3234
lua_settable(self->main_object->state,-3);
35+
lua_settop(self->main_object->state, 0);
36+
3337
}
3438

3539
void LuaCEmbedTable_set_double_by_index(LuaCEmbedTable *self, long index, double value){
@@ -47,6 +51,8 @@ void LuaCEmbedTable_set_double_by_index(LuaCEmbedTable *self, long index, doubl
4751
lua_pushnumber(self->main_object->state,(double)formatted_index);
4852
lua_pushnumber(self->main_object->state,(double )value);
4953
lua_settable(self->main_object->state,-3);
54+
lua_settop(self->main_object->state, 0);
55+
5056
}
5157

5258
void LuaCEmbedTable_set_bool_by_index(LuaCEmbedTable *self, long index, bool value){
@@ -64,6 +70,8 @@ void LuaCEmbedTable_set_bool_by_index(LuaCEmbedTable *self, long index, bool va
6470
lua_pushnumber(self->main_object->state,(double)formatted_index);
6571
lua_pushboolean(self->main_object->state,value);
6672
lua_settable(self->main_object->state,-3);
73+
lua_settop(self->main_object->state, 0);
74+
6775
}
6876

6977

@@ -90,4 +98,6 @@ void LuaCEmbedTable_set_evaluation_by_index(LuaCEmbedTable *self, long index, c
9098
lua_pushnumber(self->main_object->state,(double)formatted_index);
9199
lua_getglobal(self->main_object->state,PRIVATE_LUA_CEMBED_EVALUATION_NAME);
92100
lua_settable(self->main_object->state,-3);
101+
lua_settop(self->main_object->state, 0);
102+
93103
}

src/LuaCEmbed/table/table/setters/keys/keys.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ void LuaCEmbedTable_set_method(LuaCEmbedTable *self , const char *name, LuaCEmbe
5353
lua_getmetatable(self->main_object->state,-1);
5454
lua_setmetatable(self->main_object->state,-2);
5555
}
56+
lua_settop(self->main_object->state, 0);
5657

5758
}
5859

@@ -65,6 +66,8 @@ void LuaCEmbedTable_set_string_prop(LuaCEmbedTable *self , const char *name, co
6566
lua_pushstring(self->main_object->state,value);
6667

6768
lua_settable(self->main_object->state,-3);
69+
lua_settop(self->main_object->state, 0);
70+
6871
}
6972

7073
void LuaCEmbedTable_set_long_prop(LuaCEmbedTable *self , const char *name, long value){
@@ -74,6 +77,8 @@ void LuaCEmbedTable_set_long_prop(LuaCEmbedTable *self , const char *name, long
7477
lua_pushstring(self->main_object->state,name);
7578
lua_pushnumber(self->main_object->state,(double)value);
7679
lua_settable(self->main_object->state,-3);
80+
lua_settop(self->main_object->state, 0);
81+
7782
}
7883

7984
void LuaCEmbedTable_set_double_prop(LuaCEmbedTable *self , const char *name, double value){
@@ -84,6 +89,8 @@ void LuaCEmbedTable_set_double_prop(LuaCEmbedTable *self , const char *name, do
8489
lua_pushstring(self->main_object->state,name);
8590
lua_pushnumber(self->main_object->state,value);
8691
lua_settable(self->main_object->state,-3);
92+
lua_settop(self->main_object->state, 0);
93+
8794
}
8895

8996
void LuaCEmbedTable_set_bool_prop(LuaCEmbedTable *self , const char *name, bool value){
@@ -94,6 +101,8 @@ void LuaCEmbedTable_set_bool_prop(LuaCEmbedTable *self , const char *name, bool
94101
lua_pushstring(self->main_object->state,name);
95102
lua_pushboolean(self->main_object->state,value);
96103
lua_settable(self->main_object->state,-3);
104+
lua_settop(self->main_object->state, 0);
105+
97106
}
98107

99108
void LuaCEmbedTable_set_evaluation_prop(LuaCEmbedTable *self, const char *name, const char *code, ...){
@@ -119,4 +128,6 @@ void LuaCEmbedTable_set_evaluation_prop(LuaCEmbedTable *self, const char *name,
119128
lua_pushstring(self->main_object->state,name);
120129
lua_getglobal(self->main_object->state,PRIVATE_LUA_CEMBED_EVALUATION_NAME);
121130
lua_settable(self->main_object->state,-3);
131+
lua_settop(self->main_object->state, 0);
132+
122133
}

src/LuaCEmbed/table/table/sub_tables/index/index.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ LuaCEmbedTable *LuaCEmbedTable_new_sub_table_appending(LuaCEmbedTable *self){
1717
lua_pushinteger(self->main_object->state,index);
1818
lua_getglobal(self->main_object->state,full_sub_table_name);
1919
lua_settable(self->main_object->state,-3);
20+
lua_settop(self->main_object->state, 0);
2021

2122
LuaCEmbedTable *possible = privateLuaCEmbedTableArray_find_by_internal_index(
2223
(privateLuaCEmbedTableArray *) self->sub_tables,
@@ -121,4 +122,6 @@ void LuaCEmbedTable_set_sub_table_by_index(LuaCEmbedTable *self, long index,LuaC
121122
lua_pushinteger(self->main_object->state,formatted_index);
122123
lua_getglobal(self->main_object->state,sub_table->global_name);
123124
lua_settable(self->main_object->state,-3);
125+
lua_settop(self->main_object->state, 0);
126+
124127
}

0 commit comments

Comments
 (0)