Some modifications

1. Modify lua behaviour to support more functions.
2. Put lua state into process dict to reuse.