diff options
author | sfan5 <sfan5@live.de> | 2022-07-03 16:44:08 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2022-07-14 20:55:45 +0200 |
commit | 1d512ef7f4071fadf10078825ce83e77a3707f06 (patch) | |
tree | a839a9a84868b28b633b98b85bc158f0cb6ac4c9 /src/script/common/c_converter.h | |
parent | 8ff3fadba033dbc686c4f834811f0744099fedfb (diff) | |
download | minetest-1d512ef7f4071fadf10078825ce83e77a3707f06.tar.gz minetest-1d512ef7f4071fadf10078825ce83e77a3707f06.tar.bz2 minetest-1d512ef7f4071fadf10078825ce83e77a3707f06.zip |
Reduce code duplication between c_converter.cpp and helper.cpp
Diffstat (limited to 'src/script/common/c_converter.h')
-rw-r--r-- | src/script/common/c_converter.h | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/script/common/c_converter.h b/src/script/common/c_converter.h index 5fea3c21f..2af726d16 100644 --- a/src/script/common/c_converter.h +++ b/src/script/common/c_converter.h @@ -61,23 +61,10 @@ bool getintfield(lua_State *L, int table, return got; } -template<class T> -bool getv3intfield(lua_State *L, int index, - const char *fieldname, T &result) -{ - lua_getfield(L, index, fieldname); - bool got = false; - if (lua_istable(L, -1)) { - got |= getintfield(L, -1, "x", result.X); - got |= getintfield(L, -1, "y", result.Y); - got |= getintfield(L, -1, "z", result.Z); - } - lua_pop(L, 1); - return got; -} - +// Retrieve an v3s16 where all components are optional (falls back to default) v3s16 getv3s16field_default(lua_State *L, int table, const char *fieldname, v3s16 default_); + bool getstringfield(lua_State *L, int table, const char *fieldname, std::string &result); size_t getstringlistfield(lua_State *L, int table, |