In order to have Lawful characters, you first need to have a law. Most works provide that law in the form of The Code of Honour.
The Code is basically any code of honor or conduct that governs a certain group of people. Codes can be written down or oral tradition, they can be short or long, or practical or philosophical; the gist of the trope is that it has the more lawful characters of the cast [...] [tvtropes.org]