diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-06-04 22:38:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-04 22:38:07 +0200 |
commit | 180e551c56ec7229a15bfd9ce7339bc9881e1df6 (patch) | |
tree | 6425b85a713a8805ce42d5987cb8609c5aeb3d5b /src/script/lua_api/l_base.h | |
parent | 86b19f284990304f5c8322040f277138333a3697 (diff) | |
download | minetest-180e551c56ec7229a15bfd9ce7339bc9881e1df6.tar.xz |
Modernize lua read (part 1): C++ templating insurance (#7394)
* Modernize lua read (part 1): C++ templating assurance
Implement the float reader
Diffstat (limited to 'src/script/lua_api/l_base.h')
-rw-r--r-- | src/script/lua_api/l_base.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/script/lua_api/l_base.h b/src/script/lua_api/l_base.h index 20aa4cc09..d0160f03b 100644 --- a/src/script/lua_api/l_base.h +++ b/src/script/lua_api/l_base.h @@ -71,4 +71,15 @@ public: int top); static bool isNaN(lua_State *L, int idx); + + /** + * Read a value using a template type T from Lua State L and index + * + * @tparam T type to read from Lua + * @param L Lua state + * @param index Lua Index to read + * @return read value from Lua + */ + template<typename T> + static T readParam(lua_State *L, int index); }; |