aboutsummaryrefslogtreecommitdiff
path: root/src/macros_and_utils.h
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-03-26 17:46:00 +0100
committerBenoit Germain <benoit.germain@ubisoft.com>2024-03-26 17:46:00 +0100
commitf214d35df5f09e7026dafd8553e83cc6ea21cbde (patch)
tree2bd19bfddf4949183fe0e84ca58940fd6a6aa918 /src/macros_and_utils.h
parent2eeb245b98bd702379aa92d888f7b7d21d1193b8 (diff)
downloadlanes-f214d35df5f09e7026dafd8553e83cc6ea21cbde.tar.gz
lanes-f214d35df5f09e7026dafd8553e83cc6ea21cbde.tar.bz2
lanes-f214d35df5f09e7026dafd8553e83cc6ea21cbde.zip
C++ migration: templated lua_touserdata
Diffstat (limited to 'src/macros_and_utils.h')
-rw-r--r--src/macros_and_utils.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/macros_and_utils.h b/src/macros_and_utils.h
index c549d72..370cbed 100644
--- a/src/macros_and_utils.h
+++ b/src/macros_and_utils.h
@@ -124,3 +124,10 @@ inline void STACK_GROW(lua_State* L, int n_)
124} 124}
125 125
126#define LUAG_FUNC( func_name) int LG_##func_name( lua_State* L) 126#define LUAG_FUNC( func_name) int LG_##func_name( lua_State* L)
127
128// a small helper to extract a userdata pointer from the stack
129template<typename T>
130T* lua_touserdata(lua_State* L, int index_)
131{
132 return static_cast<T*>(lua_touserdata(L, index_));
133}