From 2b99d904f6b8197931954772b6466d8ee56cafc9 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Sat, 9 May 2015 01:38:20 -0400 Subject: Schematics: Add per-node force placement option --- src/script/common/c_converter.cpp | 13 +++++++++++++ src/script/common/c_converter.h | 2 ++ 2 files changed, 15 insertions(+) (limited to 'src/script/common') 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 @@ -331,6 +331,19 @@ bool getintfield(lua_State *L, int table, return got; } +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) { 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 @@ -53,6 +53,8 @@ size_t getstringlistfield(lua_State *L, int table, std::vector *result); 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, -- cgit v1.2.3