Fix part of #487

This commit is contained in:
halx99 2021-09-02 11:43:27 +08:00
parent a4ac70ee5f
commit d197e8b245
10 changed files with 41 additions and 68 deletions

View File

@ -634,7 +634,7 @@ struct ZipFilePrivate
zlib_filefunc_def functionOverrides{}; zlib_filefunc_def functionOverrides{};
}; };
ZipFile *ZipFile::createWithBuffer(const void* buffer, uLong size) ZipFile *ZipFile::createWithBuffer(const void* buffer, unsigned int size)
{ {
ZipFile *zip = new (std::nothrow) ZipFile(); ZipFile *zip = new (std::nothrow) ZipFile();
if (zip && zip->initWithBuffer(buffer, size)) { if (zip && zip->initWithBuffer(buffer, size)) {
@ -858,7 +858,7 @@ int ZipFile::getCurrentFileInfo(std::string* filename, unz_file_info_s* info) {
return ret; return ret;
} }
bool ZipFile::initWithBuffer(const void *buffer, uLong size) bool ZipFile::initWithBuffer(const void *buffer, unsigned int size)
{ {
if (!buffer || size == 0) return false; if (!buffer || size == 0) return false;

View File

@ -293,7 +293,7 @@ namespace cocos2d
std::string getFirstFilename(); std::string getFirstFilename();
std::string getNextFilename(); std::string getNextFilename();
static ZipFile *createWithBuffer(const void* buffer, unsigned long size); static ZipFile *createWithBuffer(const void* buffer, unsigned int size);
/** /**
* zipFile Streaming support, !!!important, the file in zip must no compress level, otherwise * zipFile Streaming support, !!!important, the file in zip must no compress level, otherwise
@ -319,7 +319,7 @@ namespace cocos2d
/* Only used internal for createWithBuffer() */ /* Only used internal for createWithBuffer() */
ZipFile(); ZipFile();
bool initWithBuffer(const void *buffer, unsigned long size); bool initWithBuffer(const void *buffer, unsigned int size);
int getCurrentFileInfo(std::string* filename, unz_file_info_s* info); int getCurrentFileInfo(std::string* filename, unz_file_info_s* info);
/** Internal data like zip file pointer / file list array and so on */ /** Internal data like zip file pointer / file list array and so on */

View File

@ -50991,7 +50991,7 @@ int lua_cocos2dx_AtlasNode_setQuadsToDraw(lua_State* tolua_S)
{ {
ssize_t arg0; ssize_t arg0;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "cc.AtlasNode:setQuadsToDraw"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "cc.AtlasNode:setQuadsToDraw");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_AtlasNode_setQuadsToDraw'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_AtlasNode_setQuadsToDraw'", nullptr);
@ -89469,7 +89469,7 @@ int lua_cocos2dx_Technique_getPassByIndex(lua_State* tolua_S)
{ {
ssize_t arg0; ssize_t arg0;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "cc.Technique:getPassByIndex"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "cc.Technique:getPassByIndex");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Technique_getPassByIndex'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Technique_getPassByIndex'", nullptr);
@ -89836,7 +89836,7 @@ int lua_cocos2dx_Material_getTechniqueByIndex(lua_State* tolua_S)
{ {
ssize_t arg0; ssize_t arg0;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "cc.Material:getTechniqueByIndex"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "cc.Material:getTechniqueByIndex");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Material_getTechniqueByIndex'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Material_getTechniqueByIndex'", nullptr);
@ -92743,7 +92743,7 @@ int lua_cocos2dx_Renderer_addDrawnVertices(lua_State* tolua_S)
{ {
ssize_t arg0; ssize_t arg0;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "cc.Renderer:addDrawnVertices"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "cc.Renderer:addDrawnVertices");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Renderer_addDrawnVertices'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Renderer_addDrawnVertices'", nullptr);
@ -93425,7 +93425,7 @@ int lua_cocos2dx_Renderer_addDrawnBatches(lua_State* tolua_S)
{ {
ssize_t arg0; ssize_t arg0;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "cc.Renderer:addDrawnBatches"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "cc.Renderer:addDrawnBatches");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Renderer_addDrawnBatches'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Renderer_addDrawnBatches'", nullptr);
@ -96797,7 +96797,7 @@ int lua_cocos2dx_SpriteBatchNode_removeChildAtIndex(lua_State* tolua_S)
ssize_t arg0; ssize_t arg0;
bool arg1; bool arg1;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "cc.SpriteBatchNode:removeChildAtIndex"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "cc.SpriteBatchNode:removeChildAtIndex");
ok &= luaval_to_boolean(tolua_S, 3,&arg1, "cc.SpriteBatchNode:removeChildAtIndex"); ok &= luaval_to_boolean(tolua_S, 3,&arg1, "cc.SpriteBatchNode:removeChildAtIndex");
if(!ok) if(!ok)
@ -97169,7 +97169,7 @@ int lua_cocos2dx_SpriteBatchNode_initWithTexture(lua_State* tolua_S)
ok &= luaval_to_object<cocos2d::Texture2D>(tolua_S, 2, "cc.Texture2D",&arg0, "cc.SpriteBatchNode:initWithTexture"); ok &= luaval_to_object<cocos2d::Texture2D>(tolua_S, 2, "cc.Texture2D",&arg0, "cc.SpriteBatchNode:initWithTexture");
ok &= luaval_to_ssize(tolua_S, 3, &arg1, "cc.SpriteBatchNode:initWithTexture"); ok &= luaval_to_ssize_t(tolua_S, 3, &arg1, "cc.SpriteBatchNode:initWithTexture");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_initWithTexture'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_initWithTexture'", nullptr);
@ -97269,7 +97269,7 @@ int lua_cocos2dx_SpriteBatchNode_reserveCapacity(lua_State* tolua_S)
{ {
ssize_t arg0; ssize_t arg0;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "cc.SpriteBatchNode:reserveCapacity"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "cc.SpriteBatchNode:reserveCapacity");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_reserveCapacity'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_reserveCapacity'", nullptr);
@ -97372,7 +97372,7 @@ int lua_cocos2dx_SpriteBatchNode_insertQuadFromSprite(lua_State* tolua_S)
ok &= luaval_to_object<cocos2d::Sprite>(tolua_S, 2, "cc.Sprite",&arg0, "cc.SpriteBatchNode:insertQuadFromSprite"); ok &= luaval_to_object<cocos2d::Sprite>(tolua_S, 2, "cc.Sprite",&arg0, "cc.SpriteBatchNode:insertQuadFromSprite");
ok &= luaval_to_ssize(tolua_S, 3, &arg1, "cc.SpriteBatchNode:insertQuadFromSprite"); ok &= luaval_to_ssize_t(tolua_S, 3, &arg1, "cc.SpriteBatchNode:insertQuadFromSprite");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_insertQuadFromSprite'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_insertQuadFromSprite'", nullptr);
@ -97439,7 +97439,7 @@ int lua_cocos2dx_SpriteBatchNode_initWithFile(lua_State* tolua_S)
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.SpriteBatchNode:initWithFile"); ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.SpriteBatchNode:initWithFile");
ok &= luaval_to_ssize(tolua_S, 3, &arg1, "cc.SpriteBatchNode:initWithFile"); ok &= luaval_to_ssize_t(tolua_S, 3, &arg1, "cc.SpriteBatchNode:initWithFile");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_initWithFile'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_initWithFile'", nullptr);
@ -97542,7 +97542,7 @@ int lua_cocos2dx_SpriteBatchNode_rebuildIndexInOrder(lua_State* tolua_S)
ok &= luaval_to_object<cocos2d::Sprite>(tolua_S, 2, "cc.Sprite",&arg0, "cc.SpriteBatchNode:rebuildIndexInOrder"); ok &= luaval_to_object<cocos2d::Sprite>(tolua_S, 2, "cc.Sprite",&arg0, "cc.SpriteBatchNode:rebuildIndexInOrder");
ok &= luaval_to_ssize(tolua_S, 3, &arg1, "cc.SpriteBatchNode:rebuildIndexInOrder"); ok &= luaval_to_ssize_t(tolua_S, 3, &arg1, "cc.SpriteBatchNode:rebuildIndexInOrder");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_rebuildIndexInOrder'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_rebuildIndexInOrder'", nullptr);
@ -97692,7 +97692,7 @@ int lua_cocos2dx_SpriteBatchNode_create(lua_State* tolua_S)
std::string arg0; std::string arg0;
ssize_t arg1; ssize_t arg1;
ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.SpriteBatchNode:create"); ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.SpriteBatchNode:create");
ok &= luaval_to_ssize(tolua_S, 3, &arg1, "cc.SpriteBatchNode:create"); ok &= luaval_to_ssize_t(tolua_S, 3, &arg1, "cc.SpriteBatchNode:create");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_create'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_create'", nullptr);
@ -97743,7 +97743,7 @@ int lua_cocos2dx_SpriteBatchNode_createWithTexture(lua_State* tolua_S)
cocos2d::Texture2D* arg0; cocos2d::Texture2D* arg0;
ssize_t arg1; ssize_t arg1;
ok &= luaval_to_object<cocos2d::Texture2D>(tolua_S, 2, "cc.Texture2D",&arg0, "cc.SpriteBatchNode:createWithTexture"); ok &= luaval_to_object<cocos2d::Texture2D>(tolua_S, 2, "cc.Texture2D",&arg0, "cc.SpriteBatchNode:createWithTexture");
ok &= luaval_to_ssize(tolua_S, 3, &arg1, "cc.SpriteBatchNode:createWithTexture"); ok &= luaval_to_ssize_t(tolua_S, 3, &arg1, "cc.SpriteBatchNode:createWithTexture");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_createWithTexture'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_createWithTexture'", nullptr);

View File

@ -18128,7 +18128,7 @@ int lua_cocos2dx_ui_ListView_scrollToItem(lua_State* tolua_S)
do{ do{
if (argc == 4) { if (argc == 4) {
ssize_t arg0; ssize_t arg0;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.ListView:scrollToItem"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.ListView:scrollToItem");
if (!ok) { break; } if (!ok) { break; }
cocos2d::Vec2 arg1; cocos2d::Vec2 arg1;
@ -18152,7 +18152,7 @@ int lua_cocos2dx_ui_ListView_scrollToItem(lua_State* tolua_S)
do{ do{
if (argc == 3) { if (argc == 3) {
ssize_t arg0; ssize_t arg0;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.ListView:scrollToItem"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.ListView:scrollToItem");
if (!ok) { break; } if (!ok) { break; }
cocos2d::Vec2 arg1; cocos2d::Vec2 arg1;
@ -18211,7 +18211,7 @@ int lua_cocos2dx_ui_ListView_jumpToItem(lua_State* tolua_S)
cocos2d::Vec2 arg1; cocos2d::Vec2 arg1;
cocos2d::Vec2 arg2; cocos2d::Vec2 arg2;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.ListView:jumpToItem"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.ListView:jumpToItem");
ok &= luaval_to_vec2(tolua_S, 3, &arg1, "ccui.ListView:jumpToItem"); ok &= luaval_to_vec2(tolua_S, 3, &arg1, "ccui.ListView:jumpToItem");
@ -18465,7 +18465,7 @@ int lua_cocos2dx_ui_ListView_insertDefaultItem(lua_State* tolua_S)
{ {
ssize_t arg0; ssize_t arg0;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.ListView:insertDefaultItem"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.ListView:insertDefaultItem");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_insertDefaultItem'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_insertDefaultItem'", nullptr);
@ -19154,7 +19154,7 @@ int lua_cocos2dx_ui_ListView_getItem(lua_State* tolua_S)
{ {
ssize_t arg0; ssize_t arg0;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.ListView:getItem"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.ListView:getItem");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_getItem'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_getItem'", nullptr);
@ -19204,7 +19204,7 @@ int lua_cocos2dx_ui_ListView_removeItem(lua_State* tolua_S)
{ {
ssize_t arg0; ssize_t arg0;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.ListView:removeItem"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.ListView:removeItem");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_removeItem'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_removeItem'", nullptr);
@ -19801,7 +19801,7 @@ int lua_cocos2dx_ui_ListView_insertCustomItem(lua_State* tolua_S)
ok &= luaval_to_object<cocos2d::ui::Widget>(tolua_S, 2, "ccui.Widget",&arg0, "ccui.ListView:insertCustomItem"); ok &= luaval_to_object<cocos2d::ui::Widget>(tolua_S, 2, "ccui.Widget",&arg0, "ccui.ListView:insertCustomItem");
ok &= luaval_to_ssize(tolua_S, 3, &arg1, "ccui.ListView:insertCustomItem"); ok &= luaval_to_ssize_t(tolua_S, 3, &arg1, "ccui.ListView:insertCustomItem");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_insertCustomItem'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_insertCustomItem'", nullptr);
@ -25185,7 +25185,7 @@ int lua_cocos2dx_ui_PageView_setCurrentPageIndex(lua_State* tolua_S)
{ {
ssize_t arg0; ssize_t arg0;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.PageView:setCurrentPageIndex"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.PageView:setCurrentPageIndex");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_setCurrentPageIndex'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_setCurrentPageIndex'", nullptr);
@ -25467,7 +25467,7 @@ int lua_cocos2dx_ui_PageView_scrollToPage(lua_State* tolua_S)
do{ do{
if (argc == 2) { if (argc == 2) {
ssize_t arg0; ssize_t arg0;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.PageView:scrollToPage"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.PageView:scrollToPage");
if (!ok) { break; } if (!ok) { break; }
double arg1; double arg1;
@ -25483,7 +25483,7 @@ int lua_cocos2dx_ui_PageView_scrollToPage(lua_State* tolua_S)
do{ do{
if (argc == 1) { if (argc == 1) {
ssize_t arg0; ssize_t arg0;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.PageView:scrollToPage"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.PageView:scrollToPage");
if (!ok) { break; } if (!ok) { break; }
cobj->scrollToPage(arg0); cobj->scrollToPage(arg0);
@ -25576,7 +25576,7 @@ int lua_cocos2dx_ui_PageView_scrollToItem(lua_State* tolua_S)
do{ do{
if (argc == 2) { if (argc == 2) {
ssize_t arg0; ssize_t arg0;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.PageView:scrollToItem"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.PageView:scrollToItem");
if (!ok) { break; } if (!ok) { break; }
double arg1; double arg1;
@ -25592,7 +25592,7 @@ int lua_cocos2dx_ui_PageView_scrollToItem(lua_State* tolua_S)
do{ do{
if (argc == 1) { if (argc == 1) {
ssize_t arg0; ssize_t arg0;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.PageView:scrollToItem"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.PageView:scrollToItem");
if (!ok) { break; } if (!ok) { break; }
cobj->scrollToItem(arg0); cobj->scrollToItem(arg0);
@ -25996,7 +25996,7 @@ int lua_cocos2dx_ui_PageView_removePageAtIndex(lua_State* tolua_S)
{ {
ssize_t arg0; ssize_t arg0;
ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.PageView:removePageAtIndex"); ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.PageView:removePageAtIndex");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_removePageAtIndex'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_removePageAtIndex'", nullptr);

View File

@ -909,7 +909,7 @@ int lua_cocos2dx_3d_AABB_updateMinMax(lua_State* L)
ok &= luaval_to_object<const cocos2d::Vec3>(L, 2, "cc.Vec3",&arg0, "cc.AABB:updateMinMax"); ok &= luaval_to_object<const cocos2d::Vec3>(L, 2, "cc.Vec3",&arg0, "cc.AABB:updateMinMax");
ok &= luaval_to_ssize(L, 3, &arg1, "cc.AABB:updateMinMax"); ok &= luaval_to_ssize_t(L, 3, &arg1, "cc.AABB:updateMinMax");
if(!ok) if(!ok)
return 0; return 0;
cobj->updateMinMax(arg0, arg1); cobj->updateMinMax(arg0, arg1);

View File

@ -528,12 +528,7 @@ bool luaval_to_physics_material(lua_State* L,int lo,PhysicsMaterial* outValue, c
} }
#endif //#if CC_USE_PHYSICS #endif //#if CC_USE_PHYSICS
bool luaval_to_ssize(lua_State* L,int lo, ssize_t* outValue, const char* funcName) bool luaval_to_ssize_t(lua_State* L, int lo, ssize_t* outValue, const char* funcName)
{
return luaval_to_long(L, lo, reinterpret_cast<long*>(outValue));
}
bool luaval_to_long(lua_State* L,int lo, long* outValue, const char* funcName)
{ {
if (NULL == L || NULL == outValue) if (NULL == L || NULL == outValue)
return false; return false;
@ -551,13 +546,13 @@ bool luaval_to_long(lua_State* L,int lo, long* outValue, const char* funcName)
if (ok) if (ok)
{ {
*outValue = (long)tolua_tonumber(L, lo, 0); *outValue = (ssize_t)tolua_tointeger(L, lo, 0);
} }
return ok; return ok;
} }
bool luaval_to_ulong(lua_State* L,int lo, unsigned long* outValue, const char* funcName) bool luaval_to_size_t(lua_State* L,int lo, size_t* outValue, const char* funcName)
{ {
if (NULL == L || NULL == outValue) if (NULL == L || NULL == outValue)
return false; return false;
@ -575,7 +570,7 @@ bool luaval_to_ulong(lua_State* L,int lo, unsigned long* outValue, const char* f
if (ok) if (ok)
{ {
*outValue = (unsigned long)tolua_tonumber(L, lo, 0); *outValue = (size_t)tolua_tointeger(L, lo, 0);
} }
return ok; return ok;

View File

@ -92,19 +92,6 @@ extern bool luaval_is_usertype(lua_State* L,int lo,const char* type, int def);
* @{ * @{
**/ **/
/**
* Get a unsigned long value from the given acceptable index of stack.
* If the value at the given acceptable index of stack is a number or a string convertible to a number it returns true, otherwise returns false.
*
* @param L the current lua_State.
* @param lo the given acceptable index of stack.
* @param outValue the pointer to store the value converted from the Lua value.
* @param funcName the name of calling function, it is used for error output in the debug model.
* @return Return true if the value at the given acceptable index of stack is a number or a string convertible to a number, otherwise return false.
*/
extern bool luaval_to_ulong(lua_State* L,int lo, unsigned long* outValue, const char* funcName="");
/** /**
* Get a unsigned short value from the given acceptable index of stack. * Get a unsigned short value from the given acceptable index of stack.
* If the value at the given acceptable index of stack is a number or a string convertible to a number it returns true, otherwise returns false. * If the value at the given acceptable index of stack is a number or a string convertible to a number it returns true, otherwise returns false.
@ -216,17 +203,6 @@ extern bool luaval_to_long_long(lua_State* L,int lo,long long* outValue, const c
extern CC_LUA_DLL bool luaval_to_std_string(lua_State* L, int lo, std::string* outValue, const char* funcName = ""); extern CC_LUA_DLL bool luaval_to_std_string(lua_State* L, int lo, std::string* outValue, const char* funcName = "");
extern CC_LUA_DLL bool luaval_to_std_string_view(lua_State* L, int lo, cxx17::string_view* outValue, const char* funcName = ""); extern CC_LUA_DLL bool luaval_to_std_string_view(lua_State* L, int lo, cxx17::string_view* outValue, const char* funcName = "");
/**
* Get a long value from the given acceptable index of stack.
* If the value at the given acceptable index of stack is a number or a string convertible to a number it returns true, otherwise returns false.
*
* @param L the current lua_State.
* @param lo the given acceptable index of stack.
* @param outValue the pointer to store the long value converted from the Lua value.
* @param funcName the name of calling function, it is used for error output in the debug model.
* @return Return true if the value at the given acceptable index of stack is a number or a string convertible to a number, otherwise return false.
*/
extern bool luaval_to_long(lua_State* L,int lo, long* outValue, const char* funcName = "");
/** /**
* Get a ssize_t value from the given acceptable index of stack. * Get a ssize_t value from the given acceptable index of stack.
@ -238,7 +214,7 @@ extern bool luaval_to_long(lua_State* L,int lo, long* outValue, const char* func
* @param funcName the name of calling function, it is used for error output in the debug model. * @param funcName the name of calling function, it is used for error output in the debug model.
* @return Return true if the value at the given acceptable index of stack is a number or a string convertible to a number, otherwise return false. * @return Return true if the value at the given acceptable index of stack is a number or a string convertible to a number, otherwise return false.
*/ */
extern bool luaval_to_ssize(lua_State* L,int lo, ssize_t* outValue, const char* funcName = ""); extern bool luaval_to_ssize_t(lua_State* L,int lo, ssize_t* outValue, const char* funcName = "");
/** /**
* Get a Size object value from the given acceptable index of stack. * Get a Size object value from the given acceptable index of stack.

View File

@ -144,6 +144,7 @@ TOLUA_API void tolua_add_value_to_root (lua_State* L,void* value);
TOLUA_API void tolua_remove_value_from_root (lua_State* L, void* value); TOLUA_API void tolua_remove_value_from_root (lua_State* L, void* value);
TOLUA_API lua_Number tolua_tonumber (lua_State* L, int narg, lua_Number def); TOLUA_API lua_Number tolua_tonumber (lua_State* L, int narg, lua_Number def);
TOLUA_API lua_Integer tolua_tointeger(lua_State* L, int narg, lua_Integer def);
TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def); TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def);
TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def); TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def);
TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def); TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def);

View File

@ -82,6 +82,9 @@ TOLUA_API lua_Number tolua_tonumber (lua_State* L, int narg, lua_Number def)
{ {
return lua_gettop(L)<abs(narg) ? def : lua_tonumber(L,narg); return lua_gettop(L)<abs(narg) ? def : lua_tonumber(L,narg);
} }
TOLUA_API lua_Integer tolua_tointeger(lua_State* L, int narg, lua_Integer def) {
return lua_gettop(L) < abs(narg) ? def : lua_tointeger(L, narg);
}
TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def) TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def)
{ {

View File

@ -38,9 +38,7 @@ conversions:
bool: "ok &= luaval_to_boolean(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")" bool: "ok &= luaval_to_boolean(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
float: "ok &= luaval_to_number(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")" float: "ok &= luaval_to_number(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
double: "ok &= luaval_to_number(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")" double: "ok &= luaval_to_number(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
long: "ok &= luaval_to_long(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")" ssize_t: "ok &= luaval_to_ssize_t(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
ssize_t: "ok &= luaval_to_ssize(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
"unsigned long": "ok &= luaval_to_ulong(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
"long long": "ok &= luaval_to_long_long(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")" "long long": "ok &= luaval_to_long_long(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
"string": "ok &= luaval_to_std_string(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")" "string": "ok &= luaval_to_std_string(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
"string_view": "ok &= luaval_to_std_string_view(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")" "string_view": "ok &= luaval_to_std_string_view(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"