소스 검색

Add method 'updateFields' to GlobalAccessor

This method allows one to update the fields of an existing table.
Ole 9 년 전
부모
커밋
2fdff00b57
1개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      lib/luwra/state.hpp

+ 10 - 0
lib/luwra/state.hpp

@@ -57,6 +57,16 @@ struct GlobalAccessor {
 	operator V() {
 		return get<V>();
 	}
+
+	/**
+	 * Update the fields of an existing table.
+	 */
+	inline
+	void updateFields(const luwra::FieldVector& fields) {
+		lua_getglobal(state, key.c_str());
+		luwra::setFields(state, -1, fields);
+		lua_pop(state, 1);
+	}
 };
 
 /**