diff options
author | kwolekr <kwolekr@minetest.net> | 2015-05-09 01:38:20 -0400 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2015-05-09 18:44:00 -0400 |
commit | 2b99d904f6b8197931954772b6466d8ee56cafc9 (patch) | |
tree | b4d75968c5d0b4072c0110de82aa35d62a1e36df /src/script/common | |
parent | d59e6ad004b64d37ac10dddd61a7b35e7baa1f89 (diff) | |
download | minetest-2b99d904f6b8197931954772b6466d8ee56cafc9.tar.gz minetest-2b99d904f6b8197931954772b6466d8ee56cafc9.tar.bz2 minetest-2b99d904f6b8197931954772b6466d8ee56cafc9.zip |
Schematics: Add per-node force placement option
Diffstat (limited to 'src/script/common')
-rw-r--r-- | src/script/common/c_converter.cpp | 13 | ||||
-rw-r--r-- | src/script/common/c_converter.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/script/common/c_converter.cpp b/src/script/common/c_converter.cpp index 157db3b7d..fc489ea95 100644 --- a/src/script/common/c_converter.cpp +++ b/src/script/common/c_converter.cpp @@ -332,6 +332,19 @@ bool getintfield(lua_State *L, int table, } bool getintfield(lua_State *L, int table, + const char *fieldname, u8 &result) +{ + lua_getfield(L, table, fieldname); + bool got = false; + if(lua_isnumber(L, -1)){ + result = lua_tonumber(L, -1); + got = true; + } + lua_pop(L, 1); + return got; +} + +bool getintfield(lua_State *L, int table, const char *fieldname, u16 &result) { lua_getfield(L, table, fieldname); diff --git a/src/script/common/c_converter.h b/src/script/common/c_converter.h index 1d5be6971..0847f47c9 100644 --- a/src/script/common/c_converter.h +++ b/src/script/common/c_converter.h @@ -54,6 +54,8 @@ size_t getstringlistfield(lua_State *L, int table, bool getintfield(lua_State *L, int table, const char *fieldname, int &result); bool getintfield(lua_State *L, int table, + const char *fieldname, u8 &result); +bool getintfield(lua_State *L, int table, const char *fieldname, u16 &result); bool getintfield(lua_State *L, int table, const char *fieldname, u32 &result); |