Procházet zdrojové kódy

Add method 'updateFields' to GlobalAccessor

This method allows one to update the fields of an existing table.
Ole před 9 roky
rodič
revize
2fdff00b57
1 změnil soubory, kde provedl 10 přidání a 0 odebrání
  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);
+	}
 };
 
 /**