aboutsummaryrefslogtreecommitdiff
path: root/src/shared/lua_api
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/lua_api')
-rw-r--r--src/shared/lua_api/common.cpp11
-rw-r--r--src/shared/lua_api/common.hpp1
-rw-r--r--src/shared/lua_api/load_net.cpp6
3 files changed, 15 insertions, 3 deletions
diff --git a/src/shared/lua_api/common.cpp b/src/shared/lua_api/common.cpp
index 68bf203..b190bdb 100644
--- a/src/shared/lua_api/common.cpp
+++ b/src/shared/lua_api/common.cpp
@@ -190,6 +190,17 @@ int poprecti(lua_State* L, long *sx, long *sy, long *ex, long *ey){
return 0;
}
+int pushrecti(lua_State* L, long sx, long sy, long ex, long ey){
+ lua_newtable(L);//{}
+ lua_pushnumber(L,1);//{},1,{sx,sy}
+ pushvector2i(L,sx,sy);//{},1,{sx,sy}
+ lua_settable(L,-3);//{{sx,sy}}
+ lua_pushnumber(L,2);//{{sx,sy}},2
+ pushvector2i(L,ex,ey);//{{sx,sy}},2,{ex,ey}
+ lua_settable(L,-3);//{{sx,sy},{ex,ey}}
+ return 1;
+}
+
int popvector2i(lua_State* L, long* a, long* b){
lua_pushinteger(L,1);
lua_gettable(L,-2);
diff --git a/src/shared/lua_api/common.hpp b/src/shared/lua_api/common.hpp
index 6086065..66da29a 100644
--- a/src/shared/lua_api/common.hpp
+++ b/src/shared/lua_api/common.hpp
@@ -18,3 +18,4 @@ int popvector3d(lua_State*,double*,double*,double*);
int popvector2i(lua_State*,long*,long*);
int poprecti(lua_State* L,long*,long*,long*,long*);
+int pushrecti(lua_State* L,long,long,long,long);
diff --git a/src/shared/lua_api/load_net.cpp b/src/shared/lua_api/load_net.cpp
index 740d997..6fe8525 100644
--- a/src/shared/lua_api/load_net.cpp
+++ b/src/shared/lua_api/load_net.cpp
@@ -166,7 +166,7 @@ int send(lua_State* L){
//socket:receive(s_name,function(stream))
int netreceive(lua_State* L){
const char* name = lua_tostring(L,-2);
- int slen = strlen(name);
+ //int slen = strlen(name);
std::string s = std::string(name);
int func = luaL_ref(L,LUA_REGISTRYINDEX);
lua_pushstring(L,"fd");
@@ -178,8 +178,8 @@ int netreceive(lua_State* L){
}
int socketFactory(lua_State*L){
- int domain = luaL_optint(L,-1,0);
- int type = luaL_optint(L,-2,0);
+ //int domain = luaL_optint(L,-1,0);
+ //int type = luaL_optint(L,-2,0);
int c = nn_socket(AF_SP,NN_PAIR);
if(c < 0){