Explorar el Código

Allow State* to be read from stack

Ole hace 9 años
padre
commit
42f034eefd
Se han modificado 1 ficheros con 9 adiciones y 0 borrados
  1. 9 0
      lib/luwra/types.hpp

+ 9 - 0
lib/luwra/types.hpp

@@ -51,6 +51,15 @@ struct Value<std::nullptr_t> {
 	}
 };
 
+template <>
+struct Value<State*> {
+	static inline
+	State* read(State* state, int n) {
+		luaL_checktype(state, n, LUA_TTHREAD);
+		return lua_tothread(state, n);
+	}
+};
+
 /**
  * Convenient wrapped for [Value<T>::push](@ref Value<T>::push).
  */