diff options
| author | Alexander Pickering <alex@cogarr.net> | 2018-06-23 06:52:55 -0600 |
|---|---|---|
| committer | Alexander Pickering <alex@cogarr.net> | 2018-06-23 06:52:55 -0600 |
| commit | e6faff1394864a1fe0d517584d1c104997dff39f (patch) | |
| tree | d7956fc8aabef903f354578d69d4d7fdf64ec928 /src/shared/lua_api/common.c | |
| parent | 1aaa348ac080c97c0aeb0a02146ae26b74add5a1 (diff) | |
| parent | 9fa5dcc9310a8c6ff8c77a47a86303f7b950dcf3 (diff) | |
| download | brokengine-e6faff1394864a1fe0d517584d1c104997dff39f.tar.gz brokengine-e6faff1394864a1fe0d517584d1c104997dff39f.tar.bz2 brokengine-e6faff1394864a1fe0d517584d1c104997dff39f.zip | |
Merge branch 'master' of ssh://cogarr.net:43/home/git/brokengine
Diffstat (limited to 'src/shared/lua_api/common.c')
| -rw-r--r-- | src/shared/lua_api/common.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/shared/lua_api/common.c b/src/shared/lua_api/common.c index 9a8baca..2eeee11 100644 --- a/src/shared/lua_api/common.c +++ b/src/shared/lua_api/common.c @@ -153,6 +153,43 @@ int popvector3d(lua_State* L,double* a,double* b,double* c){ return 0; } +int popvector4d(lua_State* L, double *a, double *b, double *c, double *d){ + lua_pushinteger(L,1);//{a,b,c,d},1 + lua_gettable(L,-2);//{a,b,c,d},a + *a = lua_tonumber(L,-1);//{a,b,c,d},a + lua_pop(L,1);//{a,b,c,d} + + lua_pushinteger(L,2); + lua_gettable(L,-2); + *b = lua_tonumber(L,-1); + lua_pop(L,1); + + lua_pushinteger(L,3); + lua_gettable(L,-2); + *c = lua_tonumber(L,-1); + lua_pop(L,1); + + lua_pushinteger(L,4); + lua_gettable(L,-2); + *d = lua_tonumber(L,-1); + lua_pop(L,1); + + lua_pop(L,1); + return 0; +} + +//{{sx,sy},{ex,ey}} +int poprecti(lua_State* L, long *sx, long *sy, long *ex, long *ey){ + lua_pushnumber(L,1); + lua_gettable(L,-2); + popvector2i(L,sx,sy); + lua_pushnumber(L,2); + lua_gettable(L,-2); + popvector2i(L,ex,ey); + lua_pop(L,1); + return 0; +} + int popvector2i(lua_State* L, long* a, long* b){ lua_pushinteger(L,1); lua_gettable(L,-2); |
