I couldn't help you on the coding. I don't know it much.
I could only suggest knowing what an addon does, and then looking at its code to see what each code part does.
As for the LUA reader/writer. I use Scintilla-WoWI. Cladhaire packaged it up and it can read and write mostly anything. PHP, XML, LUA, you name it.
Link:
http://www.wowinterface.com/download...Interface.html
Hope this helps.