diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2017-12-26 00:57:52 -0500 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2017-12-26 00:57:52 -0500 |
| commit | 35b7c646fd7f80b64c1ef49b6d81f9df9bc1b940 (patch) | |
| tree | d345f620b51ae1ad1d7923e572a6b07ed8731ee5 /src/shared/lua_api/common.c | |
| parent | cc12503339004bae2f945e7f7339fc845b2a194f (diff) | |
| download | brokengine-35b7c646fd7f80b64c1ef49b6d81f9df9bc1b940.tar.gz brokengine-35b7c646fd7f80b64c1ef49b6d81f9df9bc1b940.tar.bz2 brokengine-35b7c646fd7f80b64c1ef49b6d81f9df9bc1b940.zip | |
Major update
Diffstat (limited to 'src/shared/lua_api/common.c')
| -rw-r--r-- | src/shared/lua_api/common.c | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/src/shared/lua_api/common.c b/src/shared/lua_api/common.c index 140ece1..50eb850 100644 --- a/src/shared/lua_api/common.c +++ b/src/shared/lua_api/common.c @@ -39,19 +39,19 @@ void loadLLibs(lua_State* L){ int pushvector3i(lua_State* L,long a,long b,long c){ - lua_newtable(L); + lua_newtable(L);//{} - lua_pushinteger(L,1); - lua_pushinteger(L,a); - lua_settable(L,-3); + lua_pushinteger(L,1);//{},1 + lua_pushinteger(L,a);//{},1,a + lua_settable(L,-3);//{} - lua_pushinteger(L,2); - lua_pushinteger(L,b); - lua_settable(L,-3); + lua_pushinteger(L,2);//{},2 + lua_pushinteger(L,b);//{},2,b + lua_settable(L,-3);//{} - lua_pushinteger(L,3); - lua_pushinteger(L,c); - lua_settable(L,-3); + lua_pushinteger(L,3);//{},3 + lua_pushinteger(L,c);//{},3,c + lua_settable(L,-3);//{} return 1; } @@ -72,6 +72,19 @@ int pushvector3d(lua_State* L,double a,double b,double c){ return 1; } +int pushvector2i(lua_State* L, long a, long b){ + lua_newtable(L); + + lua_pushinteger(L,1); + lua_pushinteger(L,a); + lua_settable(L,-3); + + lua_pushinteger(L,2); + lua_pushinteger(L,b); + lua_settable(L,-3); + + return 1; +} int popvector3i(lua_State* L,long* a,long* b,long* c){//{v3} lua_pushinteger(L,1);//{v3},1 @@ -114,3 +127,17 @@ int popvector3d(lua_State* L,double* a,double* b,double* c){ lua_pop(L,1); return 0; } + +int popvector2i(lua_State* L, long* a, long* b){ + lua_pushinteger(L,1); + lua_gettable(L,-2); + *a = lua_tonumber(L,-1); + lua_pop(L,1); + + lua_pushinteger(L,2); + lua_gettable(L,-2); + *b = lua_tonumber(L,-1); + lua_pop(L,2); + + return 0; +} |
