diff options
| author | ame <[email protected]> | 2024-02-09 13:29:04 -0600 |
|---|---|---|
| committer | ame <[email protected]> | 2024-02-09 13:29:04 -0600 |
| commit | e412e6eaddfa1bc03c7e52ca36a05ff138606d35 (patch) | |
| tree | 39c92afbf5d06d4a3def8254a820d92d37a425c5 | |
| parent | 84bf02e17cac724d7898293b5f206408de413cc9 (diff) | |
get silly
| -rw-r--r-- | src/lua.c | 18 | ||||
| -rw-r--r-- | src/net.c | 1 | ||||
| -rw-r--r-- | tests/net.lua | 17 |
3 files changed, 23 insertions, 13 deletions
@@ -42,20 +42,22 @@ void i_dcopy(lua_State* src, lua_State* dest, void* _seen){ at = lua_gettop(dest);
at2 = lua_gettop(src);
- *sp = at2;
+ *sp = at;
whar = parray_get(seen, (void*)lua_topointer(src, at2));
if( whar != NULL){
- //printf("%s\n",lua_tostring(src, at2));
- //printf("WHAR\n");
-
- lua_pushvalue(dest, *(int*)whar);
+ //printf("%s\n",lua_tostring(src, at2 - 1));
+ printf("WHAR\n");
+ //lua_pop(dest, 1);
+ //lua_pushvalue(dest, *(int*)whar);
return;
} else parray_set(seen, (void*)lua_topointer(src, at2), sp);
lua_pushnil(src);
for(;lua_next(src, at2) != 0;){
lua_pushvalue(src, -2);
-
+ int a = lua_gettop(src);
+ l_pprint(src);
+ lua_settop(src, a);
i_dcopy(src, dest, seen);
lua_pushvalue(src, -2);
@@ -64,7 +66,7 @@ void i_dcopy(lua_State* src, lua_State* dest, void* _seen){ lua_settable(dest, at);
lua_pop(src, 3);
}
- lua_settop(dest, at);
+ //lua_settop(dest, at);
break;
case LUA_TFUNCTION:
if(lua_iscfunction(src, old_top)){
@@ -90,6 +92,8 @@ void i_dcopy(lua_State* src, lua_State* dest, void* _seen){ //lua_pushvalue(dest, -1);
break;
case LUA_TUSERDATA:
+ //printf("aww\n");
+ //lua_pushnumber(dest, 8);
lua_pushlightuserdata(dest, lua_touserdata(src, -1));
break;
default:
@@ -370,6 +370,7 @@ void* handle_client(void *_arg){ lua_getglobal(args->L, "_G");
i_dcopy(args->L, L, NULL);
lua_settop(args->L, old_top);
+ //l_pprint(L);
lua_setglobal(L, "_G");
pthread_mutex_unlock(&mutex);
diff --git a/tests/net.lua b/tests/net.lua index 9a7b49c..705aaab 100644 --- a/tests/net.lua +++ b/tests/net.lua @@ -7,14 +7,16 @@ sleep = function(a) end
end
aea = 5
---_G.wo = llib
+local wowa = 5
+_G.wo = llib
--_G.ww = llib
--llib.io.pprint(_G)
-llib.io.pprint(llib.net.listen(
+
+llib.net.listen(
function(server)
--llib = nil
- llib.io.pprint(_G)
- print("wowa")
+ --llib.io.pprint(_G)
+ _G.server = server
server:all("/*", function(res, req)
--llib.io.pprint(res)
--llib.io.pprint(res)
@@ -31,13 +33,16 @@ llib.io.pprint(llib.net.listen( --print("hi from first")
--llib.io.pprint(llib.crypto.md5("hewwo"))
--_G.sleep(1)
+ _G.llib.io.pprint(_G)
+ --_G.llib.io.pprint(_G.wo.crypto.md5("55"))
end)
server:GET("/aa", function(res, req)
res.header["Content-Type"] = "text/plain"
- --_G.server:lock()
+ _G.server:lock()
res:write("hi\n")
res:write("next")
+ _G.server:unlock()
res:close()
end)
@@ -49,4 +54,4 @@ llib.io.pprint(llib.net.listen( end,
8080
-))
+)
|
