Jump to content

belstgut

Members
  • Posts

    31
  • Joined

  • Last visited

  • Days Won

    2

belstgut last won the day on June 19 2016

belstgut had the most liked content!

About belstgut

  • Birthday 04/30/1992

Contact Methods

  • Website URL
    https://esport.rocks

Profile Information

  • Gender
    Male
  • Location
    Mering, Germany
  • Interests
    Some

belstgut's Achievements

Newbie

Newbie (1/14)

4

Reputation

  1. Happy Birthday belstgut!
  2. Happy Birthday belstgut!
  3. Happy Birthday belstgut!
  4. Happy Birthday belstgut!
  5. Happy Birthday belstgut!
  6. Since I got this running now, I wanted to share on how to do it. u need https://github.com/siffiejoe/lua-moon/blob/master/examples/sofix.c compiled as shared Object with -DMOON_DLFIX_LIBNAME=/path/to/silent/qagame.mp.i386.so example: gcc -DMOON_DLFIX_LIBNAME='"/home/gs/wolfet/silent/qagame.mp.i386.so"' -m32 -Wall -Wextra -I.. -fpic -shared -Os -o sofix.so sofix.c Luasocket (precompiled for 32bit): https://ptpb.pw/gyb_.zip Copas: https://github.com/keplerproject/copas/tree/master/src copy/extract luasocket, sofix.so and copas to: silent/lualibs/ after that create your luamodule. example: require('sofix') -- needs to be required before any other C based module local copas = require('copas') local asynchttp = require('copas.http').request -- random callback -- makes http request at every player connect (probably not what u wanna do) function et_ClientConnect(clientNum, firstTime, isBot) copas.addthread(function() local body, c, h = asynchttp('http://example.org/') if c ~= 200 then et.G_LogPrint(("HTTP Error: %d"):format(c)) return end -- use body and headers here. eg: et.G_LogPrint(body) end) end -- "Using gameloop as event loop" function et_RunFrame(levelTime) if levelTime % 500 ~= 0 then return end copas.step() end I am currently using a structure like that and haven't experienced any lags till now.
  7. sure there are more callbacks. I mean every lua script which has the et_ClientConnect function gets called when a player connects.
  8. having threads in lua should not be a problem, since u can just bind a C module anyway. But I would like to return a ~= nil value based on the result of the request in the et_ClientConnect callback. how would I do that? I mean even if I fork the networking into a seperate thread, the function would still have to wait for that thread to finish, so I could return sth. I almost think that this would not be possible. So probably just always return nil and then kick based on the result. Still, this could be done more beautifully like calling every callback in its own thread and collecting the return values in an array. when all callbacks are finished, iterate over the results instead of calling the callbacks in a loop.
  9. So I got everything working now. One problem though, using luasocket http is blocking. Since I am using this in et_clientConnect (not always though) everytime I do the http request the server lags until the request has finished. I return nil or a string based on the result of the request. Is there any way I could make this callback nonblocking? (like let it execute for more than 1 server frame, the client has to wait for the result though)?
  10. Nvm. I got it working. Dunno what changed But I compiled luasocket again and now it works. odd
  11. Does noone has any more ideas? Or maybe its not even a problem with luasockets but with my take on it. Can someone try and check if it works for you?
  12. check the wiki. pretty much everything is documented there: http://mygamingtalk.com/wiki/SilEnT_Mod
  13. Curl works though. So sockets seem to be working. I tried lcurl which links against libcurl and it worked. I dont like the callback structure of curl though. So if anyone has a wrapper around that
  14. "libstdc++.so.6: cannot open shared object file: No such file or directory" thats exactly your problem. I think u are missing the 32 bit version of libc and libstdc++
  15. Btw, luasockets work in the systemwide lua interpreter. (5.3.1 32bit) Lua 5.3.1 Copyright © 1994-2015 Lua.org, PUC-Rio> http = require'socket.http'> print(http.request('http://127.0.0.1'))Hi there 200 table: 0x80c1600 HTTP/1.1 200 OK /usr/bin/lua5.3: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=5c238fe30c288fab06fd2c3e25bbffb575a48700, stripped
×
×
  • Create New...