-lua script write logic

Signed-off-by: ymsquall <ymsquare@hotmail.com>