diff options
| author | ame <[email protected]> | 2024-02-22 16:21:17 -0600 |
|---|---|---|
| committer | ame <[email protected]> | 2024-02-22 16:21:17 -0600 |
| commit | cca165b4b737cc672814134403c857f0dc7ba183 (patch) | |
| tree | 7acbf3e0436f9e8ce187b660d7df5d1acfc4ff5f /src/lua.c | |
| parent | 2116bc776b93e40feea08904e690e34ec76b2ae5 (diff) | |
clean but small problem:c
Diffstat (limited to 'src/lua.c')
| -rw-r--r-- | src/lua.c | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -43,11 +43,14 @@ void i_dcopy(lua_State* src, lua_State* dest, void* _seen){ //int *sp;
char* s;
void* whar;
+ double n;
int old_top = lua_gettop(src);
//printf("%i\n",ii++);
switch(lua_type(src, -1)){
case LUA_TNUMBER:
- lua_pushnumber(dest, luaL_checknumber(src, -1));
+ n = luaL_checknumber(src, -1);
+ if(n == (int)n) lua_pushinteger(dest, (int)n);
+ else lua_pushnumber(dest, n);
break;
case LUA_TSTRING:
s = (char*)luaL_checklstring(src, -1, &len);
@@ -106,15 +109,8 @@ void i_dcopy(lua_State* src, lua_State* dest, void* _seen){ str* awa = str_init("");
lua_dump(src, writer, (void*)awa, 0);
- //l_pprint(src);
- //lua_pcall(src, 1, 1, 0);
- //l_pprint(src);
- //lua_settop(src, oo);
- //lua_pop(src, 6);
-
- //s = (char*)luaL_checklstring(src, -1, &len);
lua_pushlstring(dest, awa->c, awa->len);
- //for(int i = 0; i != awa->len; i++) printf("%i : %c\n",i, awa->c[i]);
+
luaL_loadbuffer(dest, awa->c, awa->len, awa->c);
lua_remove(dest, -2);
str_free(awa);
|
