aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua/modules/net')
-rw-r--r--src/lua/modules/net/je_lua_buffer.cpp18
-rw-r--r--src/lua/modules/net/je_lua_buffer.h2
-rw-r--r--src/lua/modules/net/je_lua_net.cpp16
-rw-r--r--src/lua/modules/net/je_lua_socket.cpp26
4 files changed, 31 insertions, 31 deletions
diff --git a/src/lua/modules/net/je_lua_buffer.cpp b/src/lua/modules/net/je_lua_buffer.cpp
index d2342f3..fd73364 100644
--- a/src/lua/modules/net/je_lua_buffer.cpp
+++ b/src/lua/modules/net/je_lua_buffer.cpp
@@ -1,6 +1,6 @@
#include "lua/modules/luax.h"
#include "lua/modules/types.h"
-#include "lua/common/common.h"
+#include "lua/common/je_lua_common.h"
#include "libjin/jin.h"
#include "je_lua_buffer.h"
@@ -22,7 +22,7 @@ namespace JinEngine
}
// net.Buffer:append(value) -> value_length
- static int l_append(lua_State* L)
+ LUA_IMPLEMENT int l_append(lua_State* L)
{
BufferRef ref = checkNetBuffer(L);
const int vp = 2;
@@ -66,7 +66,7 @@ namespace JinEngine
}
// net.Buffer:grabString(offset) -> string, length
- static int l_grabString(lua_State* L)
+ LUA_IMPLEMENT int l_grabString(lua_State* L)
{
BufferRef ref = checkNetBuffer(L);
int offset = luax_checkinteger(L, 2);
@@ -80,7 +80,7 @@ namespace JinEngine
}
// net.Buffer:grabInteger(offset) -> integer, length
- static int l_grabInteger(lua_State* L)
+ LUA_IMPLEMENT int l_grabInteger(lua_State* L)
{
BufferRef ref = checkNetBuffer(L);
int offset = luax_checkinteger(L, 2);
@@ -91,7 +91,7 @@ namespace JinEngine
return 2;
}
- static int l_grabFloat(lua_State* L)
+ LUA_IMPLEMENT int l_grabFloat(lua_State* L)
{
BufferRef ref = checkNetBuffer(L);
int offset = luax_checkinteger(L, 2);
@@ -102,7 +102,7 @@ namespace JinEngine
return 2;
}
- static int l_grabBoolean(lua_State* L)
+ LUA_IMPLEMENT int l_grabBoolean(lua_State* L)
{
BufferRef ref = checkNetBuffer(L);
int offset = luax_checkinteger(L, 2);
@@ -113,14 +113,14 @@ namespace JinEngine
return 2;
}
- static int l_gc(lua_State* L)
+ LUA_IMPLEMENT int l_gc(lua_State* L)
{
Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_NETWORK_BUFFER);
proxy->release();
return 0;
}
- static const luaL_Reg netbuffer_function[] = {
+ LUA_IMPLEMENT const luaL_Reg netbuffer_function[] = {
{ "__gc", l_gc },
{ "append", l_append },
{ "grabString", l_grabString },
@@ -132,7 +132,7 @@ namespace JinEngine
} // namespace Net
- int luaopen_Buffer(lua_State* L)
+ LUA_EXPORT int luaopen_Buffer(lua_State* L)
{
luax_newtype(L, JIN_NETWORK_BUFFER, Net::netbuffer_function);
return 0;
diff --git a/src/lua/modules/net/je_lua_buffer.h b/src/lua/modules/net/je_lua_buffer.h
index 8733778..d713f53 100644
--- a/src/lua/modules/net/je_lua_buffer.h
+++ b/src/lua/modules/net/je_lua_buffer.h
@@ -3,7 +3,7 @@
#include <cstring>
#include <cstdlib>
-#include "lua/common/common.h"
+#include "lua/common/je_lua_common.h"
namespace JinEngine
{
diff --git a/src/lua/modules/net/je_lua_net.cpp b/src/lua/modules/net/je_lua_net.cpp
index c477477..de5d506 100644
--- a/src/lua/modules/net/je_lua_net.cpp
+++ b/src/lua/modules/net/je_lua_net.cpp
@@ -1,7 +1,7 @@
#include "lua/modules/luax.h"
#include "lua/modules/types.h"
#include "libjin/jin.h"
-#include "lua/common/common.h"
+#include "lua/common/je_lua_common.h"
#include "je_lua_buffer.h"
namespace JinEngine
@@ -12,13 +12,13 @@ namespace Lua
using namespace JinEngine::Lua::Net;
using namespace JinEngine::Net;
- static int l_initNetwork(lua_State* L)
+ LUA_IMPLEMENT int l_initNetwork(lua_State* L)
{
JinEngine::Net::NetManager::get()->init();
return 1;
}
- static int l_Socket(lua_State* L)
+ LUA_IMPLEMENT int l_Socket(lua_State* L)
{
SocketInformation info = { 0 };
{
@@ -53,7 +53,7 @@ namespace Lua
return 1;
}
- static int l_Buffer(lua_State* L)
+ LUA_IMPLEMENT int l_Buffer(lua_State* L)
{
int size = luax_checkinteger(L, 1);
Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_NETWORK_BUFFER, sizeof(Proxy));
@@ -62,17 +62,17 @@ namespace Lua
return 1;
}
- static const luaL_Reg f[] = {
+ LUA_IMPLEMENT const luaL_Reg f[] = {
{ "init", l_initNetwork },
{ "newSocket", l_Socket },
{ "newBuffer", l_Buffer },
{ 0, 0 }
};
- extern int luaopen_Socket(lua_State* L);
- extern int luaopen_Buffer(lua_State* L);
+ LUA_PORT int luaopen_Socket(lua_State* L);
+ LUA_PORT int luaopen_Buffer(lua_State* L);
- int luaopen_net(lua_State* L)
+ LUA_EXPORT int luaopen_net(lua_State* L)
{
luaopen_Socket(L);
luaopen_Buffer(L);
diff --git a/src/lua/modules/net/je_lua_socket.cpp b/src/lua/modules/net/je_lua_socket.cpp
index 7ad6057..512bde3 100644
--- a/src/lua/modules/net/je_lua_socket.cpp
+++ b/src/lua/modules/net/je_lua_socket.cpp
@@ -1,6 +1,6 @@
#include "lua/modules/luax.h"
#include "lua/modules/types.h"
-#include "lua/common/common.h"
+#include "lua/common/je_lua_common.h"
#include "libjin/jin.h"
#include "je_lua_buffer.h"
@@ -16,20 +16,20 @@ namespace JinEngine
const int BUFFER_SIZE = 1024;
- static inline SocketRef checkSocket(lua_State* L, int pos = 1)
+ LUA_IMPLEMENT inline SocketRef checkSocket(lua_State* L, int pos = 1)
{
Proxy* proxy = (Proxy*)luax_checktype(L, pos, JIN_NETWORK_SOCKET);
return proxy->getRef<Socket>();
}
- static inline Ref<Buffer>& checkNetBuffer(lua_State* L, int pos = 1)
+ LUA_IMPLEMENT inline Ref<Buffer>& checkNetBuffer(lua_State* L, int pos = 1)
{
Proxy* proxy = (Proxy*)luax_checktype(L, pos, JIN_NETWORK_BUFFER);
return proxy->getRef<Buffer>();
}
// return net.Socket
- static int l_accept(lua_State* L)
+ LUA_IMPLEMENT int l_accept(lua_State* L)
{
SocketRef socket = checkSocket(L);
Socket* client = socket->accept();
@@ -39,7 +39,7 @@ namespace JinEngine
}
// return net.Buffer
- static int l_receive(lua_State* L)
+ LUA_IMPLEMENT int l_receive(lua_State* L)
{
SocketRef socket = checkSocket(L);
char buffer[BUFFER_SIZE] = {0};
@@ -51,7 +51,7 @@ namespace JinEngine
}
// Socket:receiveFrom(address, port)
- static int l_receiveFrom(lua_State* L)
+ LUA_IMPLEMENT int l_receiveFrom(lua_State* L)
{
SocketRef socket = checkSocket(L);
int address = luax_checkinteger(L, 2);
@@ -65,7 +65,7 @@ namespace JinEngine
}
// Socket:send(net.Buffer) -> data_length
- static int l_send(lua_State* L)
+ LUA_IMPLEMENT int l_send(lua_State* L)
{
SocketRef socket = checkSocket(L);
Ref<Buffer>& ref = checkNetBuffer(L, 2);
@@ -75,7 +75,7 @@ namespace JinEngine
}
// Socket:sendTo(address, port, net.Buffer)
- static int l_sendTo(lua_State* L)
+ LUA_IMPLEMENT int l_sendTo(lua_State* L)
{
SocketRef socket = checkSocket(L);
int address = luax_checkinteger(L, 2);
@@ -85,14 +85,14 @@ namespace JinEngine
return 0;
}
- static int l_close(lua_State* L)
+ LUA_IMPLEMENT int l_close(lua_State* L)
{
SocketRef socket = checkSocket(L);
socket->close();
return 0;
}
- static int l_configBlocking(lua_State* L)
+ LUA_IMPLEMENT int l_configBlocking(lua_State* L)
{
SocketRef socket = checkSocket(L);
bool blocking = luax_checkbool(L, 2);
@@ -100,14 +100,14 @@ namespace JinEngine
return 0;
}
- static int l_gc(lua_State* L)
+ LUA_IMPLEMENT int l_gc(lua_State* L)
{
Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_NETWORK_SOCKET);
proxy->release();
return 0;
}
- static const luaL_Reg socket_function[] = {
+ LUA_IMPLEMENT const luaL_Reg socket_function[] = {
{ "__gc", l_gc },
{ "accept", l_accept },
{ "receive", l_receive },
@@ -119,7 +119,7 @@ namespace JinEngine
{ 0, 0 }
};
- int luaopen_Socket(lua_State* L)
+ LUA_EXPORT int luaopen_Socket(lua_State* L)
{
luax_newtype(L, JIN_NETWORK_SOCKET, socket_function);
return 0;