Replaced #define min by Lua min