Skip to content

Commit eb74aa1

Browse files
att
1 parent 92b50ec commit eb74aa1

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

src/LuaCEmbed/callback_handle/fdefine.callback_handle.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,19 @@ int privateLuaCEmbed_main_callback_handler(lua_State *L){
7979
}
8080

8181
if(possible_return->type == PRIVATE_LUA_CEMBED_LONG_RESPONSE){
82-
lua_pushinteger(L, (int)possible_return->num_val);
82+
lua_pushinteger(L, possible_return->int_val);
8383
private_LuaCEmbedResponse_free(possible_return);
8484
return PRIVATE_LUACEMBED_ONE_RETURN;
8585
}
8686

8787
if(possible_return->type == PRIVATE_LUA_CEMBED_BOOL_RESPONSE){
88-
lua_pushboolean(L, (bool)possible_return->num_val);
88+
lua_pushboolean(L, (bool)possible_return->int_val);
8989
private_LuaCEmbedResponse_free(possible_return);
9090
return PRIVATE_LUACEMBED_ONE_RETURN;
9191
}
9292

9393
if(possible_return->type == PRIVATE_LUA_CEMBED_DOUBLE_RESPONSE){
94-
lua_pushnumber(L, possible_return->num_val);
94+
lua_pushnumber(L, possible_return->double_val);
9595
private_LuaCEmbedResponse_free(possible_return);
9696
return PRIVATE_LUACEMBED_ONE_RETURN;
9797
}
@@ -102,11 +102,6 @@ int privateLuaCEmbed_main_callback_handler(lua_State *L){
102102
return PRIVATE_LUACEMBED_ONE_RETURN;
103103
}
104104

105-
if(possible_return->type == PRIVATE_LUA_CEMBED_DOUBLE_RESPONSE){
106-
lua_pushboolean(L, (bool)possible_return->num_val);
107-
private_LuaCEmbedResponse_free(possible_return);
108-
return PRIVATE_LUACEMBED_ONE_RETURN;
109-
}
110105

111106
if(possible_return->type == PRIVATE_LUA_CEMBED_TABLE_RESPONSE){
112107
lua_getglobal(self->state, PRIVATE_LUA_CEMBED_TABLE_RETURN);
@@ -233,4 +228,4 @@ void LuaCEmbed_add_global_callback(LuaCEmbed *self, const char *callback_name, L
233228
return;
234229
}
235230
private_LuaCEmbed_add_evaluation_callback(self,callback_name,callback);
236-
}
231+
}

src/LuaCEmbedResponse/fdefine.LuaCEmbedResponse.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ LuaCEmbedResponse *private_LuaCEmbedReturn_raw(){
1515
LuaCEmbedResponse * LuaCEmbed_send_bool(bool value){
1616
LuaCEmbedResponse * self= private_LuaCEmbedReturn_raw();
1717
self->type = PRIVATE_LUA_CEMBED_BOOL_RESPONSE;
18-
self->num_val = (double)value;
18+
self->int_val = value;
1919
return self;
2020
}
2121

@@ -100,14 +100,14 @@ LuaCEmbedResponse * LuaCEmbed_send_evaluation(const char *code){
100100
LuaCEmbedResponse * LuaCEmbed_send_double(double value){
101101
LuaCEmbedResponse * self= private_LuaCEmbedReturn_raw();
102102
self->type = PRIVATE_LUA_CEMBED_DOUBLE_RESPONSE;
103-
self->num_val = value;
103+
self->double_val = value;
104104
return self;
105105
}
106106

107107
LuaCEmbedResponse * LuaCEmbed_send_long(lua_Integer value){
108108
LuaCEmbedResponse * self= private_LuaCEmbedReturn_raw();
109109
self->type = PRIVATE_LUA_CEMBED_LONG_RESPONSE;
110-
self->num_val = (double)value;
110+
self->int_val = value;
111111
return self;
112112
}
113113

src/LuaCEmbedResponse/types.LuaCembedResponse.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
typedef struct {
88

99
int type;
10-
double num_val;
10+
double double_val;
11+
lua_Integer int_val;
1112
bool its_string_ref;
1213
lua_Integer string_size;
1314
char *string_val;

0 commit comments

Comments
 (0)