added MIT license to all files. Optimized luaL checks.