@@ -340,12 +340,12 @@ bool luaval_to_vec2(lua_State* L,int lo,cocos2d::Vec2* outValue, const char* fun
340
340
{
341
341
lua_pushstring (L, " x" );
342
342
lua_gettable (L, lo);
343
- outValue->x = lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 );
343
+ outValue->x = lua_isnil (L, -1 ) ? 0 . 0f : ( float ) lua_tonumber (L, -1 );
344
344
lua_pop (L, 1 );
345
345
346
346
lua_pushstring (L, " y" );
347
347
lua_gettable (L, lo);
348
- outValue->y = lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 );
348
+ outValue->y = lua_isnil (L, -1 ) ? 0 . 0f : ( float ) lua_tonumber (L, -1 );
349
349
lua_pop (L, 1 );
350
350
}
351
351
return ok;
@@ -372,17 +372,17 @@ bool luaval_to_vec3(lua_State* L,int lo,cocos2d::Vec3* outValue, const char* fun
372
372
{
373
373
lua_pushstring (L, " x" );
374
374
lua_gettable (L, lo);
375
- outValue->x = lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 );
375
+ outValue->x = lua_isnil (L, -1 ) ? 0 . 0f : ( float ) lua_tonumber (L, -1 );
376
376
lua_pop (L, 1 );
377
377
378
378
lua_pushstring (L, " y" );
379
379
lua_gettable (L, lo);
380
- outValue->y = lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 );
380
+ outValue->y = lua_isnil (L, -1 ) ? 0 . 0f : ( float ) lua_tonumber (L, -1 );
381
381
lua_pop (L, 1 );
382
382
383
383
lua_pushstring (L, " z" );
384
384
lua_gettable (L, lo);
385
- outValue->z = lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 );
385
+ outValue->z = lua_isnil (L, -1 ) ? 0 . 0f : ( float ) lua_tonumber (L, -1 );
386
386
lua_pop (L, 1 );
387
387
}
388
388
return ok;
@@ -409,22 +409,22 @@ bool luaval_to_vec4(lua_State* L,int lo,cocos2d::Vec4* outValue, const char* fun
409
409
{
410
410
lua_pushstring (L, " x" );
411
411
lua_gettable (L, lo);
412
- outValue->x = lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 );
412
+ outValue->x = lua_isnil (L, -1 ) ? 0 . 0f : ( float ) lua_tonumber (L, -1 );
413
413
lua_pop (L, 1 );
414
414
415
415
lua_pushstring (L, " y" );
416
416
lua_gettable (L, lo);
417
- outValue->y = lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 );
417
+ outValue->y = lua_isnil (L, -1 ) ? 0 . 0f : ( float ) lua_tonumber (L, -1 );
418
418
lua_pop (L, 1 );
419
419
420
420
lua_pushstring (L, " z" );
421
421
lua_gettable (L, lo);
422
- outValue->z = lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 );
422
+ outValue->z = lua_isnil (L, -1 ) ? 0 . 0f : ( float ) lua_tonumber (L, -1 );
423
423
lua_pop (L, 1 );
424
424
425
425
lua_pushstring (L, " w" );
426
426
lua_gettable (L, lo);
427
- outValue->w = lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 );
427
+ outValue->w = lua_isnil (L, -1 ) ? 0 . 0f : ( float ) lua_tonumber (L, -1 );
428
428
lua_pop (L, 1 );
429
429
}
430
430
return ok;
@@ -490,17 +490,17 @@ bool luaval_to_physics_material(lua_State* L,int lo,PhysicsMaterial* outValue, c
490
490
{
491
491
lua_pushstring (L, " density" );
492
492
lua_gettable (L, lo);
493
- outValue->density = lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 );
493
+ outValue->density = lua_isnil (L, -1 ) ? 0 . 0f : ( float ) lua_tonumber (L, -1 );
494
494
lua_pop (L, 1 );
495
495
496
496
lua_pushstring (L, " restitution" );
497
497
lua_gettable (L, lo);
498
- outValue->restitution = lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 );
498
+ outValue->restitution = lua_isnil (L, -1 ) ? 0 . 0f : ( float ) lua_tonumber (L, -1 );
499
499
lua_pop (L, 1 );
500
500
501
501
lua_pushstring (L, " friction" );
502
502
lua_gettable (L, lo);
503
- outValue->friction = lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 );
503
+ outValue->friction = lua_isnil (L, -1 ) ? 0 . 0f : ( float ) lua_tonumber (L, -1 );
504
504
lua_pop (L, 1 );
505
505
}
506
506
return ok;
@@ -580,12 +580,12 @@ bool luaval_to_size(lua_State* L,int lo,Size* outValue, const char* funcName)
580
580
{
581
581
lua_pushstring (L, " width" ); /* L: paramStack key */
582
582
lua_gettable (L,lo);/* L: paramStack paramStack[lo][key] */
583
- outValue->width = lua_isnil (L,-1 ) ? 0 : lua_tonumber (L,-1 );
583
+ outValue->width = lua_isnil (L,-1 ) ? 0 . 0f : ( float ) lua_tonumber (L,-1 );
584
584
lua_pop (L,1 );/* L: paramStack*/
585
585
586
586
lua_pushstring (L, " height" );
587
587
lua_gettable (L,lo);
588
- outValue->height = lua_isnil (L,-1 ) ? 0 : lua_tonumber (L,-1 );
588
+ outValue->height = lua_isnil (L,-1 ) ? 0 . 0f : ( float ) lua_tonumber (L,-1 );
589
589
lua_pop (L,1 );
590
590
}
591
591
@@ -612,22 +612,22 @@ bool luaval_to_rect(lua_State* L,int lo,Rect* outValue, const char* funcName)
612
612
{
613
613
lua_pushstring (L, " x" );
614
614
lua_gettable (L,lo);
615
- outValue->origin .x = lua_isnil (L,-1 ) ? 0 : lua_tonumber (L,-1 );
615
+ outValue->origin .x = lua_isnil (L,-1 ) ? 0 . 0f : ( float ) lua_tonumber (L,-1 );
616
616
lua_pop (L,1 );
617
617
618
618
lua_pushstring (L, " y" );
619
619
lua_gettable (L,lo);
620
- outValue->origin .y = lua_isnil (L,-1 ) ? 0 : lua_tonumber (L,-1 );
620
+ outValue->origin .y = lua_isnil (L,-1 ) ? 0 . 0f : ( float ) lua_tonumber (L,-1 );
621
621
lua_pop (L,1 );
622
622
623
623
lua_pushstring (L, " width" );
624
624
lua_gettable (L,lo);
625
- outValue->size .width = lua_isnil (L,-1 ) ? 0 : lua_tonumber (L,-1 );
625
+ outValue->size .width = lua_isnil (L,-1 ) ? 0 . 0f : ( float ) lua_tonumber (L,-1 );
626
626
lua_pop (L,1 );
627
627
628
628
lua_pushstring (L, " height" );
629
629
lua_gettable (L,lo);
630
- outValue->size .height = lua_isnil (L,-1 ) ? 0 : lua_tonumber (L,-1 );
630
+ outValue->size .height = lua_isnil (L,-1 ) ? 0 . 0f : ( float ) lua_tonumber (L,-1 );
631
631
lua_pop (L,1 );
632
632
}
633
633
@@ -654,22 +654,22 @@ bool luaval_to_color4b(lua_State* L,int lo,Color4B* outValue, const char* funcNa
654
654
{
655
655
lua_pushstring (L, " r" );
656
656
lua_gettable (L,lo);
657
- outValue->r = lua_isnil (L,-1 ) ? 0 : lua_tonumber (L,-1 );
657
+ outValue->r = lua_isnil (L,-1 ) ? 0 : static_cast < uint8_t >( lua_tonumber (L,-1 ) );
658
658
lua_pop (L,1 );
659
659
660
660
lua_pushstring (L, " g" );
661
661
lua_gettable (L,lo);
662
- outValue->g = lua_isnil (L,-1 ) ? 0 : lua_tonumber (L,-1 );
662
+ outValue->g = lua_isnil (L,-1 ) ? 0 : static_cast < uint8_t >( lua_tonumber (L,-1 ) );
663
663
lua_pop (L,1 );
664
664
665
665
lua_pushstring (L, " b" );
666
666
lua_gettable (L,lo);
667
- outValue->b = lua_isnil (L,-1 ) ? 0 : lua_tonumber (L,-1 );
667
+ outValue->b = lua_isnil (L,-1 ) ? 0 : static_cast < uint8_t >( lua_tonumber (L,-1 ) );
668
668
lua_pop (L,1 );
669
669
670
670
lua_pushstring (L, " a" );
671
671
lua_gettable (L,lo);
672
- outValue->a = lua_isnil (L,-1 ) ? 255 : lua_tonumber (L,-1 );
672
+ outValue->a = lua_isnil (L,-1 ) ? 255 : static_cast < uint8_t >( lua_tonumber (L,-1 ) );
673
673
lua_pop (L,1 );
674
674
}
675
675
@@ -696,22 +696,22 @@ bool luaval_to_color4f(lua_State* L,int lo,Color4F* outValue, const char* funcNa
696
696
{
697
697
lua_pushstring (L, " r" );
698
698
lua_gettable (L,lo);
699
- outValue->r = lua_isnil (L,-1 ) ? 0 : lua_tonumber (L,-1 );
699
+ outValue->r = lua_isnil (L,-1 ) ? 0 . 0f : ( float ) lua_tonumber (L,-1 );
700
700
lua_pop (L,1 );
701
701
702
702
lua_pushstring (L, " g" );
703
703
lua_gettable (L,lo);
704
- outValue->g = lua_isnil (L,-1 ) ? 0 : lua_tonumber (L,-1 );
704
+ outValue->g = lua_isnil (L,-1 ) ? 0 . 0f : ( float ) lua_tonumber (L,-1 );
705
705
lua_pop (L,1 );
706
706
707
707
lua_pushstring (L, " b" );
708
708
lua_gettable (L,lo);
709
- outValue->b = lua_isnil (L,-1 ) ? 0 : lua_tonumber (L,-1 );
709
+ outValue->b = lua_isnil (L,-1 ) ? 0 . 0f : ( float ) lua_tonumber (L,-1 );
710
710
lua_pop (L,1 );
711
711
712
712
lua_pushstring (L, " a" );
713
713
lua_gettable (L,lo);
714
- outValue->a = lua_isnil (L,-1 ) ? 0 : lua_tonumber (L,-1 );
714
+ outValue->a = lua_isnil (L,-1 ) ? 0 . 0f : ( float ) lua_tonumber (L,-1 );
715
715
lua_pop (L,1 );
716
716
}
717
717
@@ -738,17 +738,17 @@ bool luaval_to_color3b(lua_State* L,int lo,Color3B* outValue, const char* funcNa
738
738
{
739
739
lua_pushstring (L, " r" );
740
740
lua_gettable (L,lo);
741
- outValue->r = lua_isnil (L,-1 ) ? 0 : lua_tonumber (L,-1 );
741
+ outValue->r = lua_isnil (L,-1 ) ? 0 : static_cast < uint8_t >( lua_tonumber (L,-1 ) );
742
742
lua_pop (L,1 );
743
743
744
744
lua_pushstring (L, " g" );
745
745
lua_gettable (L,lo);
746
- outValue->g = lua_isnil (L,-1 ) ? 0 : lua_tonumber (L,-1 );
746
+ outValue->g = lua_isnil (L,-1 ) ? 0 : static_cast < uint8_t >( lua_tonumber (L,-1 ) );
747
747
lua_pop (L,1 );
748
748
749
749
lua_pushstring (L, " b" );
750
750
lua_gettable (L,lo);
751
- outValue->b = lua_isnil (L,-1 ) ? 0 : lua_tonumber (L,-1 );
751
+ outValue->b = lua_isnil (L,-1 ) ? 0 : static_cast < uint8_t >( lua_tonumber (L,-1 ) );
752
752
lua_pop (L,1 );
753
753
}
754
754
@@ -945,7 +945,7 @@ bool luaval_to_fontdefinition(lua_State* L, int lo, FontDefinition* outValue , c
945
945
lua_gettable (L,lo);
946
946
if (!lua_isnil (L,-1 ))
947
947
{
948
- outValue->_shadow ._shadowOpacity = lua_tonumber (L,-1 );
948
+ outValue->_shadow ._shadowOpacity = ( float ) lua_tonumber (L,-1 );
949
949
}
950
950
lua_pop (L,1 );
951
951
}
@@ -1011,7 +1011,7 @@ bool luaval_to_ttfconfig(lua_State* L,int lo, cocos2d::TTFConfig* outValue, cons
1011
1011
1012
1012
lua_pushstring (L, " fontSize" );
1013
1013
lua_gettable (L,lo);
1014
- outValue->fontSize = lua_isnumber (L, -1 )?(int )lua_tointeger (L, -1 ) : 0 ;
1014
+ outValue->fontSize = lua_isnumber (L, -1 )?(float )lua_tointeger (L, -1 ) : 0 . 0f ;
1015
1015
lua_pop (L,1 );
1016
1016
1017
1017
lua_pushstring (L, " glyphs" );
@@ -1071,7 +1071,7 @@ bool luaval_to_mat4(lua_State* L, int lo, cocos2d::Mat4* outValue , const char*
1071
1071
lua_gettable (L,lo);
1072
1072
if (tolua_isnumber (L, -1 , 0 , &tolua_err))
1073
1073
{
1074
- outValue->m [i] = tolua_tonumber (L, -1 , 0 );
1074
+ outValue->m [i] = ( float ) tolua_tonumber (L, -1 , 0 );
1075
1075
}
1076
1076
else
1077
1077
{
@@ -1976,22 +1976,22 @@ bool luaval_to_quaternion(lua_State* L,int lo,cocos2d::Quaternion* outValue, con
1976
1976
{
1977
1977
lua_pushstring (L, " x" );
1978
1978
lua_gettable (L, lo);
1979
- outValue->x = lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 );
1979
+ outValue->x = lua_isnil (L, -1 ) ? 0 . 0f : ( float ) lua_tonumber (L, -1 );
1980
1980
lua_pop (L, 1 );
1981
1981
1982
1982
lua_pushstring (L, " y" );
1983
1983
lua_gettable (L, lo);
1984
- outValue->y = lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 );
1984
+ outValue->y = lua_isnil (L, -1 ) ? 0 . 0f : ( float ) lua_tonumber (L, -1 );
1985
1985
lua_pop (L, 1 );
1986
1986
1987
1987
lua_pushstring (L, " z" );
1988
1988
lua_gettable (L, lo);
1989
- outValue->z = lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 );
1989
+ outValue->z = lua_isnil (L, -1 ) ? 0 . 0f : ( float ) lua_tonumber (L, -1 );
1990
1990
lua_pop (L, 1 );
1991
1991
1992
1992
lua_pushstring (L, " w" );
1993
1993
lua_gettable (L, lo);
1994
- outValue->w = lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 );
1994
+ outValue->w = lua_isnil (L, -1 ) ? 0 . 0f : ( float ) lua_tonumber (L, -1 );
1995
1995
lua_pop (L, 1 );
1996
1996
}
1997
1997
return ok;
@@ -2017,22 +2017,22 @@ bool luaval_to_texparams(lua_State* L,int lo,cocos2d::Texture2D::TexParams* outV
2017
2017
{
2018
2018
lua_pushstring (L, " minFilter" );
2019
2019
lua_gettable (L, lo);
2020
- outValue->minFilter = utils::toBackendSamplerFilter (lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 ));
2020
+ outValue->minFilter = utils::toBackendSamplerFilter (lua_isnil (L, -1 ) ? 0 : lua_tointeger (L, -1 ));
2021
2021
lua_pop (L, 1 );
2022
2022
2023
2023
lua_pushstring (L, " magFilter" );
2024
2024
lua_gettable (L, lo);
2025
- outValue->magFilter = utils::toBackendSamplerFilter (lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 ));
2025
+ outValue->magFilter = utils::toBackendSamplerFilter (lua_isnil (L, -1 ) ? 0 : lua_tointeger (L, -1 ));
2026
2026
lua_pop (L, 1 );
2027
2027
2028
2028
lua_pushstring (L, " wrapS" );
2029
2029
lua_gettable (L, lo);
2030
- outValue->sAddressMode = utils::toBackendAddressMode (lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 ));
2030
+ outValue->sAddressMode = utils::toBackendAddressMode (lua_isnil (L, -1 ) ? 0 : lua_tointeger (L, -1 ));
2031
2031
lua_pop (L, 1 );
2032
2032
2033
2033
lua_pushstring (L, " wrapT" );
2034
2034
lua_gettable (L, lo);
2035
- outValue->tAddressMode = utils::toBackendAddressMode (lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 ));
2035
+ outValue->tAddressMode = utils::toBackendAddressMode (lua_isnil (L, -1 ) ? 0 : lua_tointeger (L, -1 ));
2036
2036
lua_pop (L, 1 );
2037
2037
}
2038
2038
return ok;
@@ -2054,21 +2054,19 @@ bool luaval_to_tex2f(lua_State* L, int lo, cocos2d::Tex2F* outValue, const char*
2054
2054
ok = false ;
2055
2055
}
2056
2056
2057
-
2058
2057
if (ok)
2059
2058
{
2060
2059
lua_pushstring (L, " u" );
2061
2060
lua_gettable (L, lo);
2062
- outValue->u = lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 );
2061
+ outValue->u = lua_isnil (L, -1 ) ? 0 . 0f : ( float ) lua_tonumber (L, -1 );
2063
2062
lua_pop (L, 1 );
2064
2063
2065
2064
lua_pushstring (L, " v" );
2066
2065
lua_gettable (L, lo);
2067
- outValue->v = lua_isnil (L, -1 ) ? 0 : lua_tonumber (L, -1 );
2066
+ outValue->v = lua_isnil (L, -1 ) ? 0 . 0f : ( float ) lua_tonumber (L, -1 );
2068
2067
lua_pop (L, 1 );
2069
2068
}
2070
2069
return ok;
2071
-
2072
2070
}
2073
2071
2074
2072
0 commit comments