Quellcode durchsuchen

Allow State* to be read from stack

Ole vor 9 Jahren
Ursprung
Commit
42f034eefd
1 geänderte Dateien mit 9 neuen und 0 gelöschten Zeilen
  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).
  */