Skip to content

Commit 1189e0f

Browse files
att
1 parent 2150828 commit 1189e0f

File tree

6 files changed

+242
-54
lines changed

6 files changed

+242
-54
lines changed

LuaCEmbed.h

Lines changed: 99 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27862,6 +27862,7 @@ typedef struct {
2786227862

2786327863
void (*set_sub_table_by_index)(LuaCEmbedTable *self, long index,LuaCEmbedTable *sub_table);
2786427864
void (*set_string_by_index)(LuaCEmbedTable *self, long index, const char *value);
27865+
void (*set_raw_string_by_index)(LuaCEmbedTable *self, long index, const char *value,long size);
2786527866
void (*set_long_by_index)(LuaCEmbedTable *self, long long index, long value);
2786627867
void (*set_double_by_index)(LuaCEmbedTable *self, long index, double value);
2786727868
void (*set_bool_by_index)(LuaCEmbedTable *self, long index, bool value);
@@ -27873,11 +27874,14 @@ typedef struct {
2787327874

2787427875
void (*set_method)(LuaCEmbedTable *self , const char *name, LuaCEmbedResponse *(*callback)(LuaCEmbedTable *self, LuaCEmbed *args));
2787527876
void (*set_string_prop)(LuaCEmbedTable *self , const char *name, const char *value);
27877+
void (*set_raw_string_prop)(LuaCEmbedTable *self , const char *name, const char *value,long size);
27878+
2787627879
void (*set_long_prop)(LuaCEmbedTable *self , const char *name, long long value);
2787727880
void (*set_double_prop)(LuaCEmbedTable *self , const char *name, double value);
2787827881
void (*set_bool_prop)(LuaCEmbedTable *self , const char *name, bool value);
2787927882
int (*get_type_prop)(LuaCEmbedTable *self, const char *name);
2788027883
char* (*get_string_prop)(LuaCEmbedTable *self , const char *name);
27884+
char* (*get_raw_string_prop)(LuaCEmbedTable *self, const char *name,long *size);
2788127885
long long (*get_long_prop)(LuaCEmbedTable *self , const char *name);
2788227886
double (*get_double_prop)(LuaCEmbedTable *self , const char *name);
2788327887
bool (*get_bool_prop)(LuaCEmbedTable *self , const char *name);
@@ -27895,6 +27899,8 @@ typedef struct {
2789527899
long long (*get_long_by_index)(LuaCEmbedTable *self, int index);
2789627900
double (*get_double_by_index)(LuaCEmbedTable *self, int index);
2789727901
char * (*get_string_by_index)(LuaCEmbedTable *self, int index);
27902+
char * (*get_raw_string_by_index)(LuaCEmbedTable *self, int index, long *size);
27903+
2789827904
bool (*get_bool_by_index)(LuaCEmbedTable *self, int index);
2789927905

2790027906
}LuaCembedTableModule;
@@ -28329,9 +28335,9 @@ double LuaCEmbedTable_get_double_by_index(LuaCEmbedTable *self, int index);
2832928335

2833028336
char * LuaCEmbedTable_get_string_by_index(LuaCEmbedTable *self, int index);
2833128337

28332-
bool LuaCEmbedTable_get_bool_by_index(LuaCEmbedTable *self, int index);
28333-
28338+
char * LuaCEmbedTable_get_raw_string_by_index(LuaCEmbedTable *self, int index, long *size);
2833428339

28340+
bool LuaCEmbedTable_get_bool_by_index(LuaCEmbedTable *self, int index);
2833528341

2833628342

2833728343
//path: src/imports/../LuaCEmbed/table/table/getters/keys/fdeclare.keys.h
@@ -28342,6 +28348,8 @@ bool LuaCEmbedTable_get_bool_by_index(LuaCEmbedTable *self, int index);
2834228348

2834328349
char* LuaCembedTable_get_string_prop(LuaCEmbedTable *self, const char *name);
2834428350

28351+
char* LuaCembedTable_get_raw_string_prop(LuaCEmbedTable *self, const char *name,long *size);
28352+
2834528353
long long LuaCembedTable_get_long_prop(LuaCEmbedTable *self, const char *name);
2834628354

2834728355
double LuaCembedTable_get_double_prop(LuaCEmbedTable *self, const char *name);
@@ -28357,6 +28365,8 @@ int LuaCEmbedTable_get_type_prop(LuaCEmbedTable *self, const char *name);
2835728365

2835828366
void LuaCEmbedTable_set_string_by_index(LuaCEmbedTable *self, long index, const char *value);
2835928367

28368+
void LuaCEmbedTable_set_raw_string_by_index(LuaCEmbedTable *self, long index, const char *value,long size);
28369+
2836028370
void LuaCEmbedTable_set_long_by_index(LuaCEmbedTable *self, long long index, long value);
2836128371

2836228372
void LuaCEmbedTable_set_double_by_index(LuaCEmbedTable *self, long index, double value);
@@ -28398,6 +28408,8 @@ void LuaCEmbedTable_set_method(LuaCEmbedTable *self, const char *name, LuaCEmbed
2839828408

2839928409
void LuaCEmbedTable_set_string_prop(LuaCEmbedTable *self, const char *name, const char *value);
2840028410

28411+
void LuaCEmbedTable_set_raw_string_prop(LuaCEmbedTable *self , const char *name, const char *value,long size);
28412+
2840128413
void LuaCEmbedTable_set_long_prop(LuaCEmbedTable *self, const char *name, long long value);
2840228414

2840328415
void LuaCEmbedTable_set_double_prop(LuaCEmbedTable *self, const char *name, double value);
@@ -28408,7 +28420,6 @@ void LuaCEmbedTable_set_bool_prop(LuaCEmbedTable *self, const char *name, bool
2840828420
void LuaCEmbedTable_set_evaluation_prop(LuaCEmbedTable *self, const char *name, const char *code, ...);
2840928421

2841028422

28411-
2841228423
//path: src/imports/../LuaCEmbed/table/table/sub_tables/index/fdeclare.index.h
2841328424
//mannaged by silver chain
2841428425

@@ -30596,6 +30607,44 @@ char * LuaCEmbedTable_get_string_by_index(LuaCEmbedTable *self, int index){
3059630607
return NULL;
3059730608
}
3059830609

30610+
char * LuaCEmbedTable_get_raw_string_by_index(LuaCEmbedTable *self, int index, long *size){
30611+
PRIVATE_LUA_CEMBED_TABLE_PROTECT_NULL
30612+
30613+
int formatted_index = index + LUA_CEMBED_INDEX_DIF;
30614+
30615+
lua_getglobal(self->main_object->state,self->global_name);
30616+
int table_index = lua_gettop(self->main_object->state);
30617+
long converted_index = privateLuaCEmbedTable_convert_index(self,formatted_index);
30618+
int total = 1;
30619+
lua_pushnil(self->main_object->state);
30620+
while(lua_next(self->main_object->state,table_index)){
30621+
if(total == converted_index){
30622+
if(privateLuaCEmbedTable_ensure_type_with_index(self,converted_index,LUA_CEMBED_STRING)){
30623+
lua_pop(self->main_object->state,1);
30624+
PRIVATE_LUA_CEMBED_TABLE_CLEAR_STACK
30625+
return NULL;
30626+
}
30627+
char * result = (char*)lua_tolstring(self->main_object->state,-1,(size_t*)size);
30628+
lua_pop(self->main_object->state,1);
30629+
PRIVATE_LUA_CEMBED_TABLE_CLEAR_STACK
30630+
return result;
30631+
}
30632+
lua_pop(self->main_object->state,1);
30633+
total+=1;
30634+
30635+
}
30636+
30637+
privateLuaCEmbed_raise_error_not_jumping(
30638+
self->main_object,
30639+
PRIVATE_LUA_CEMBED_WRONG_TYPE_INDEX,
30640+
index,
30641+
self->global_name,
30642+
LuaCembed_convert_arg_code(LUA_CEMBED_NIL),
30643+
LuaCembed_convert_arg_code(LUA_CEMBED_STRING)
30644+
);
30645+
PRIVATE_LUA_CEMBED_TABLE_CLEAR_STACK
30646+
return NULL;
30647+
}
3059930648
bool LuaCEmbedTable_get_bool_by_index(LuaCEmbedTable *self, int index){
3060030649
PRIVATE_LUA_CEMBED_TABLE_PROTECT_BOOL
3060130650

@@ -30634,6 +30683,7 @@ bool LuaCEmbedTable_get_bool_by_index(LuaCEmbedTable *self, int index){
3063430683
return LUA_CEMBED_GENERIC_ERROR;
3063530684
}
3063630685

30686+
3063730687
//path: src/imports/../LuaCEmbed/table/table/getters/keys/fdefine.keys.c
3063830688
//mannaged by silver chain
3063930689

@@ -30662,6 +30712,19 @@ char* LuaCembedTable_get_string_prop(LuaCEmbedTable *self , const char *name){
3066230712
return value;
3066330713
}
3066430714

30715+
char* LuaCembedTable_get_raw_string_prop(LuaCEmbedTable *self, const char *name,long *size){
30716+
PRIVATE_LUA_CEMBED_TABLE_PROTECT_NULL
30717+
30718+
lua_getglobal(self->main_object->state,self->global_name);
30719+
privateLuaCEmbd_get_field_protected(self->main_object,name);
30720+
if(privateLuaCEmbedTable_ensure_type_with_key(self, name, LUA_CEMBED_STRING)){
30721+
return NULL;
30722+
}
30723+
30724+
char *value = (char*)lua_tolstring(self->main_object->state,-1,(size_t*)size);
30725+
PRIVATE_LUA_CEMBED_TABLE_CLEAR_STACK
30726+
return value;
30727+
}
3066530728

3066630729
long long LuaCembedTable_get_long_prop(LuaCEmbedTable *self , const char *name){
3066730730
PRIVATE_LUA_CEMBED_TABLE_PROTECT_NUM
@@ -30727,9 +30790,27 @@ void LuaCEmbedTable_set_string_by_index(LuaCEmbedTable *self, long index, const
3072730790
lua_pushstring(self->main_object->state,value);
3072830791
lua_settable(self->main_object->state,-3);
3072930792
lua_settop(self->main_object->state, 0);
30793+
}
3073030794

30795+
30796+
void LuaCEmbedTable_set_raw_string_by_index(LuaCEmbedTable *self, long index, const char *value,long size){
30797+
PRIVATE_LUA_CEMBED_TABLE_PROTECT_VOID
30798+
30799+
char *possible_key = LuaCembedTable_get_key_by_index(self,index);
30800+
if(possible_key){
30801+
LuaCEmbedTable_set_string_prop(self,possible_key,value);
30802+
return;
30803+
}
30804+
long formatted_index = index + LUA_CEMBED_INDEX_DIF;
30805+
lua_getglobal(self->main_object->state,self->global_name);
30806+
lua_pushnumber(self->main_object->state,(double)formatted_index);
30807+
lua_pushlstring(self->main_object->state,value,size);
30808+
lua_settable(self->main_object->state,-3);
30809+
lua_settop(self->main_object->state, 0);
3073130810
}
3073230811

30812+
30813+
3073330814
void LuaCEmbedTable_set_long_by_index(LuaCEmbedTable *self, long long index, long value){
3073430815
PRIVATE_LUA_CEMBED_TABLE_PROTECT_VOID
3073530816

@@ -31004,6 +31085,16 @@ void LuaCEmbedTable_set_string_prop(LuaCEmbedTable *self , const char *name, co
3100431085
lua_settable(self->main_object->state,-3);
3100531086
lua_settop(self->main_object->state, 0);
3100631087

31088+
}
31089+
void LuaCEmbedTable_set_raw_string_prop(LuaCEmbedTable *self , const char *name, const char *value,long size){
31090+
PRIVATE_LUA_CEMBED_TABLE_PROTECT_VOID
31091+
31092+
lua_getglobal(self->main_object->state,self->global_name);
31093+
lua_pushstring(self->main_object->state,name);
31094+
lua_pushlstring(self->main_object->state,value,size);
31095+
lua_settable(self->main_object->state,-3);
31096+
lua_settop(self->main_object->state, 0);
31097+
3100731098
}
3100831099

3100931100
void LuaCEmbedTable_set_long_prop(LuaCEmbedTable *self , const char *name, long long value){
@@ -31065,6 +31156,7 @@ void LuaCEmbedTable_set_evaluation_prop(LuaCEmbedTable *self, const char *name,
3106531156

3106631157
}
3106731158

31159+
3106831160
//path: src/imports/../LuaCEmbed/table/table/sub_tables/index/fdefine.index.c
3106931161
//mannaged by silver chain
3107031162

@@ -31707,7 +31799,7 @@ LuaCembedTableModule newLuaCembedTableModule(){
3170731799
self.set_double_prop = LuaCEmbedTable_set_double_prop;
3170831800
self.set_long_prop = LuaCEmbedTable_set_long_prop;
3170931801
self.set_string_prop = LuaCEmbedTable_set_string_prop;
31710-
31802+
self.set_raw_string_prop = LuaCEmbedTable_set_raw_string_prop;
3171131803
self.get_sub_table_prop = LuaCEmbedTable_get_sub_table_by_key;
3171231804
self.new_sub_table_prop = LuaCEmbedTable_new_sub_table_by_key;
3171331805
self.set_sub_table_prop = LuaCEmbedTable_set_sub_table_prop;
@@ -31718,17 +31810,18 @@ LuaCembedTableModule newLuaCembedTableModule(){
3171831810
self.get_double_prop = LuaCembedTable_get_double_prop;
3171931811
self.get_long_prop = LuaCembedTable_get_long_prop;
3172031812
self.get_string_prop = LuaCembedTable_get_string_prop;
31813+
self.get_raw_string_prop= LuaCembedTable_get_raw_string_prop;
3172131814
self.get_type_prop = LuaCEmbedTable_get_type_prop;
3172231815
self.destroy_prop = LuaCembedTable_destroy_prop;
3172331816

3172431817
self.set_long_by_index = LuaCEmbedTable_set_long_by_index;
3172531818
self.set_bool_by_index= LuaCEmbedTable_set_bool_by_index;
3172631819
self.set_double_by_index =LuaCEmbedTable_set_double_by_index;
3172731820
self.set_string_by_index = LuaCEmbedTable_set_string_by_index;
31821+
self.set_raw_string_by_index = LuaCEmbedTable_set_raw_string_by_index;
3172831822
self.set_evaluation_by_index = LuaCEmbedTable_set_evaluation_by_index;
3172931823

3173031824
self.get_listable_size = LuaCEmbedTable_get_listable_size;
31731-
3173231825
self.new_sub_table_appending = LuaCEmbedTable_new_sub_table_appending;
3173331826
self.has_key = LuaCembedTable_has_key_at_index;
3173431827
self.get_key_by_index = LuaCembedTable_get_key_by_index;
@@ -31738,6 +31831,7 @@ LuaCembedTableModule newLuaCembedTableModule(){
3173831831
self.get_double_by_index = LuaCEmbedTable_get_double_by_index;
3173931832
self.get_bool_by_index = LuaCEmbedTable_get_bool_by_index;
3174031833
self.get_string_by_index= LuaCEmbedTable_get_string_by_index;
31834+
self.get_raw_string_by_index =LuaCEmbedTable_get_raw_string_by_index;
3174131835
self.get_sub_table_by_index = LuaCEmbedTable_get_sub_table_by_index;
3174231836
return self;
3174331837
}

0 commit comments

Comments
 (0)