Giter Site home page Giter Site logo

lua-enet's Introduction

lua-enet's People

Contributors

alloyed avatar leafo avatar martinfelis avatar naelstrof avatar slime73 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lua-enet's Issues

Suggestions; adding the following to ENetHost references in Lua.

/* returns a string referencing the printable ip address of the current host /
static int host_get_address(lua_State
l)
{
ENetHost *host = check_host(l, 1);
std::string address;
char buff[1024];
enet_address_get_host_ip(&host->address, buff, 1024);
address.clear();
address.append(buff);
lua_pushstring(l, address.c_str());
return 1;
}

/* and in function registry */

static const struct luaL_Reg enet_host_funcs [] =
{
{"service", host_service},
{"check_events", host_check_events},
{"compress_with_range_coder", host_compress_with_range_coder},
{"connect", host_connect},
{"flush", host_flush},
{"broadcast", host_broadcast},
{"channel_limit", host_channel_limit},
{"bandwidth_limit", host_bandwidth_limit},
{"total_sent_data", host_total_sent_data},
{"total_received_data", host_total_received_data},
{"service_time", host_service_time},
{"peer_count", host_peer_count},
{"get_peer", host_get_peer},
{"get_address", host_get_address},
{NULL, NULL}
};

If you find this useful, please add it. I'm currently using that add on function to run local server auto detection.

MSVCR80.dll issue

I'm not sure what could be the problem, but i'm facing a weird issue with lua-enet. I'm adding multiplayer support to one old C++/SDL game and i was using luasockets before which was working just fine but i wanted to try lua-enet. I'm developing it using Wine on macOS because the game was only for Windows. It's working there using Wine just fine, both client and server connects, all works as it should but i have problems getting it to work on Windows natively.
I either get a MSVCR80.dll not found error there or if i put the C++ runtime dll next to lua5.1.dll and other stuff then it shows R6034 An application has made an attempt to load the C runtime library incorrectly. error.

I think that recompiling could help, but i wanted to ask first before compiling it myself.

require "enet" in lua5.1.exe works just fine and also client/server works that way

Build issues on ubuntu 12.04

I was trying to recreate an issue that @Bobbyjoness (Sorry bobbyjones) was having, and I was able to reproduce it.

I'm guessing that the enet deps on 12.04 are old, but perhaps there's a way to compensate?

This is from a pretty fresh ubuntu 12.04 vm instance;

seppi@seppi-VirtualBox:~$ cat /etc/issue
Ubuntu 12.04.2 LTS \n \l

seppi@seppi-VirtualBox:~$ sudo apt-get install libenet* luarocks
[sudo] password for seppi: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libenet-dev' for regex 'libenet*'
Note, selecting 'libenet-doc' for regex 'libenet*'
Note, selecting 'libenet1a-dbg' for regex 'libenet*'
Note, selecting 'libenet1' for regex 'libenet*'
Note, selecting 'libenet1-dev' for regex 'libenet*'
Note, selecting 'libenet1a' for regex 'libenet*'
luarocks is already the newest version.
The following packages were automatically installed and are no longer required:
  libflac++6 liblove
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  libenet-dev libenet-doc libenet1a libenet1a-dbg
0 upgraded, 4 newly installed, 0 to remove and 244 not upgraded.
Need to get 136 kB of archives.
After this operation, 1,106 kB of additional disk space will be used.
Do you want to continue [Y/n]? 
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise/universe libenet1a amd64 1.3.3-2ubuntu1 [22.4 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ precise/universe libenet-dev amd64 1.3.3-2ubuntu1 [10.1 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ precise/universe libenet-doc all 1.3.3-2ubuntu1 [65.5 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ precise/universe libenet1a-dbg amd64 1.3.3-2ubuntu1 [38.0 kB]
Fetched 136 kB in 0s (192 kB/s)     
Selecting previously unselected package libenet1a.
(Reading database ... 166398 files and directories currently installed.)
Unpacking libenet1a (from .../libenet1a_1.3.3-2ubuntu1_amd64.deb) ...
Selecting previously unselected package libenet-dev.
Unpacking libenet-dev (from .../libenet-dev_1.3.3-2ubuntu1_amd64.deb) ...
Selecting previously unselected package libenet-doc.
Unpacking libenet-doc (from .../libenet-doc_1.3.3-2ubuntu1_all.deb) ...
Selecting previously unselected package libenet1a-dbg.
Unpacking libenet1a-dbg (from .../libenet1a-dbg_1.3.3-2ubuntu1_amd64.deb) ...
Processing triggers for doc-base ...
Processing 1 added doc-base file...
Setting up libenet1a (1.3.3-2ubuntu1) ...
Setting up libenet-dev (1.3.3-2ubuntu1) ...
Setting up libenet-doc (1.3.3-2ubuntu1) ...
Setting up libenet1a-dbg (1.3.3-2ubuntu1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
seppi@seppi-VirtualBox:~$ sudo luarocks install enet
Installing http://luarocks.org/repositories/rocks/enet-1.1-1.src.rock...
Using http://luarocks.org/repositories/rocks/enet-1.1-1.src.rock... switching to 'build' mode
Archive:  /tmp/luarocks_luarocks-rock-enet-1.1-1-9633/enet-1.1-1.src.rock
  inflating: enet-1.1-1.rockspec     
   creating: lua-enet/
   creating: lua-enet/examples/
   creating: lua-enet/examples/unreliable/
  inflating: lua-enet/examples/unreliable/server.lua  
  inflating: lua-enet/examples/unreliable/client.lua  
   creating: lua-enet/examples/simple/
  inflating: lua-enet/examples/simple/server.lua  
  inflating: lua-enet/examples/simple/client.lua  
   creating: lua-enet/examples/channels/
  inflating: lua-enet/examples/channels/server.lua  
  inflating: lua-enet/examples/channels/client.lua  
  inflating: lua-enet/enet.c         
  inflating: lua-enet/enet-dev-1.rockspec  
   creating: lua-enet/docs/
  inflating: lua-enet/docs/index.md  
  inflating: lua-enet/README.md      
  inflating: lua-enet/Makefile       
gcc -O2 -fPIC -I/usr/include/lua5.1 -c enet.c -o enet.o -I/usr/include
enet.c: In function ‘peer_ping_interval’:
enet.c:490:26: error: ‘ENetPeer’ has no member named ‘pingInterval’
enet.c: In function ‘peer_timeout’:
enet.c:513:26: error: ‘ENetPeer’ has no member named ‘timeoutLimit’
enet.c:514:26: error: ‘ENetPeer’ has no member named ‘timeoutMinimum’
enet.c:515:26: error: ‘ENetPeer’ has no member named ‘timeoutMaximum’

Error: Build error: Failed compiling object enet.o

error loading module enet

Hi. I'm getting the following error on Ubuntu 14.04 while trying to use enet in lua. It's installed using luarocks. The enet lib is installed from source, version 1.3.12.
What could be the problem?

lua5.1: error loading module 'enet' from file '/usr/local/lib/lua/5.1/enet.so':
libenet.so.7: cannot open shared object file: No such file or directory
stack traceback:
[C]: ?
[C]: in function 'require'
server.lua:2: in main chunk
[C]: ?

undefined symbol: luaL_checkint

when i run the server/client demo i get this error

lua: error loading module 'enet' from file '/usr/lib/lua/5.4/enet.so':
/usr/lib/lua/5.4/enet.so: undefined symbol: luaL_checkint
stack traceback:
[C]: in ?
[C]: in function 'require'
server.lua:2: in main chunk
[C]: in ?

Peer round trip time information

The peer userdata seems to be lacking any way to access its information about round trip time. It would be useful to make this and other peer information available to Lua.

Undefined symbol: luaL_openlib

kuteshi@universe-1 ~/lol % lua server.lua
lua: error loading module 'enet' from file '/usr/local/lib/lua/5.3/enet.so':
/usr/local/lib/lua/5.3/enet.so: undefined symbol: luaL_openlib
stack traceback:
[C]: in ?
[C]: in function 'require'
server.lua:1: in main chunk
[C]: in ?
kuteshi@universe-1 ~/lol %

lua-enet on Windows

I've been attempting to get the bindings building and running on Windows, and haven't had much luck. I was able to get a .dll generated but upon attempting to run the echo server example Lua outputs the following:

-- server.lua
require "enet"
local host = enet.host_create"localhost:6789"
while true do
local event = host:service(100)
if event and event.type == "receive" then
print("Got message: ", event.data, event.peer)
event.peer:send(event.data)
end
end

lua: error loading module 'enet' from file '.\enet.dll':
The specified procedure could not be found.

stack traceback:
[C]: ?
[C]: in function 'require'
server\main.lua:2: in main chunk
[C]: ?

I imagine I'm doing something stupid while building. Are there any binaries existing for Windows that are confirmed working? I wasn't able to get it working through luarocks (couldn't find ENET_DIR despite it being set correctly) and had to manually build it within VS2005.

add some server send, broadcast, channel, flag for examples.

Trying to run some example for easy understand how this code work with Love2D and Lovr. Not much docs example or explain how it works.

server.lua

for peerIndex = 1, host:peer_count() do
    local peer = host:get_peer(peerIndex)
    if peer then
      peer:send("Hi")
    end
  end

It took time to dig some issues to find this. #19

If you have time to update some example on client and server for send, broadcast, channel and flag.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.