Lua scripting and getting the IP address

I am relatively new to Suricata.

How would I write a Lua script to get the IP address of a given connection? is the best way to write some sort of decoder from hex and to just use the whole http packet?

You can use SCPacketTuple or SCFlowTuple: