ofxLua pushTable example?

(still pretty new so I hope you’ll excuse any dumb questions)

I am looking to get midi controller values from ofxMidi and send them to a lua table for my script to use.

I believe I need something like this (based on the ofxLua test examples)

(note - I’m defining my midi_msg table in a required lua file as midi_msg = {} )

ofxMidiMessage message = midiMessages.front(); // from an example using `std::queue<ofxMidiMessage> midiMessages;`

	if(message.status == MIDI_CONTROL_CHANGE) {
		lua.pushTable("midi_msg");
		lua.setString(1, "cc");  			//	type = "cc";
		lua.setNumber(2, message.control);	//	cc = message.control;
		lua.setNumber(3, message.value);	//	value = message.value;
		lua.setNumber(4, message.channel);	//	chan = message.channel;		
		lua.popTable();		
	}	

I’m not sure I understand the lua.popTable(); - what is that about?

Otherwise - am I on the right track here?

Also - can I set the Key for each of the table items so the lua table would end up like this:
{type = "cc", cc = message.control, value = message.value, chan = message.channel } ?