From 180e551c56ec7229a15bfd9ce7339bc9881e1df6 Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Mon, 4 Jun 2018 22:38:07 +0200 Subject: Modernize lua read (part 1): C++ templating insurance (#7394) * Modernize lua read (part 1): C++ templating assurance Implement the float reader --- src/script/lua_api/l_base.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/script/lua_api/l_base.h') 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 + static T readParam(lua_State *L, int index); }; -- cgit v1.2.3