aboutsummaryrefslogtreecommitdiff
path: root/src/script/common
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-05-09 01:38:20 -0400
committerkwolekr <kwolekr@minetest.net>2015-05-09 18:44:00 -0400
commit2b99d904f6b8197931954772b6466d8ee56cafc9 (patch)
treeb4d75968c5d0b4072c0110de82aa35d62a1e36df /src/script/common
parentd59e6ad004b64d37ac10dddd61a7b35e7baa1f89 (diff)
downloadminetest-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.cpp13
-rw-r--r--src/script/common/c_converter.h2
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);