cocos2d-lua gl.clearColor 这个函数无法用

cocos2d-lua gl.clearColor(r,g,b,a)这4个参数本应该传递之间任意数,可是传比如r=0.9 最终传递的是r=0
找到该函数的lua绑定接口

在LuaOpengl.cpp的static int tolua_Cocos2d_glClearColor00(lua_State* tolua_S)函数里

unsigned int red = (unsigned int)tolua_tonumber(tolua_S,1,0);
unsigned int green = (unsigned int)tolua_tonumber(tolua_S,2,0);
unsigned int blue = (unsigned int)tolua_tonumber(tolua_S,3,0);
unsigned int alpha = (unsigned int)tolua_tonumber(tolua_S,4,0);
glClearColor((GLclampf)red , (GLclampf)green , (GLclampf)blue , (GLclampf)alpha);

(unsigned int)为毛要强转成int!

这个bug…

巨坑。。。。。。