aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2024-08-10 22:24:19 +0800
committerLi Jin <dragon-fly@qq.com>2024-08-10 22:24:19 +0800
commite88db61abe46304e756dc328a01b46f3b4be99d5 (patch)
treee7f7fc8c3e2ac21f7c8fec1fd02bc5c39ce5b9d8 /src
parenta3bde93c37e59d8d0e47d61bfde9b28a95eded89 (diff)
downloadyuescript-e88db61abe46304e756dc328a01b46f3b4be99d5.tar.gz
yuescript-e88db61abe46304e756dc328a01b46f3b4be99d5.tar.bz2
yuescript-e88db61abe46304e756dc328a01b46f3b4be99d5.zip
fix Lua5.1 build.v0.24.0
Diffstat (limited to 'src')
-rw-r--r--src/yuescript/yuescript.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/yuescript/yuescript.cpp b/src/yuescript/yuescript.cpp
index 84a9554..b8513e7 100644
--- a/src/yuescript/yuescript.cpp
+++ b/src/yuescript/yuescript.cpp
@@ -365,12 +365,12 @@ static int yuetoast(lua_State* L) {
365 yue::Utils::trim(str); 365 yue::Utils::trim(str);
366 lua_pushlstring(L, str.c_str(), str.length()); 366 lua_pushlstring(L, str.c_str(), str.length());
367 lua_rawseti(L, -2, 4); 367 lua_rawseti(L, -2, 4);
368 lua_rawseti(L, tableIndex, lua_objlen(L, tableIndex) + 1); 368 lua_rawseti(L, tableIndex, static_cast<int>(lua_objlen(L, tableIndex)) + 1);
369 break; 369 break;
370 } 370 }
371 case 1: { 371 case 1: {
372 if (flattenLevel > 1 || (flattenLevel == 1 && !current.hasSep)) { 372 if (flattenLevel > 1 || (flattenLevel == 1 && !current.hasSep)) {
373 lua_rawgeti(L, tableIndex, lua_objlen(L, tableIndex) + 1); 373 lua_rawgeti(L, tableIndex, static_cast<int>(lua_objlen(L, tableIndex)) + 1);
374 getName(node); 374 getName(node);
375 lua_rawseti(L, -2, 1); 375 lua_rawseti(L, -2, 1);
376 lua_pushinteger(L, node->m_begin.m_line); 376 lua_pushinteger(L, node->m_begin.m_line);
@@ -383,7 +383,7 @@ static int yuetoast(lua_State* L) {
383 [[fallthrough]]; 383 [[fallthrough]];
384 } 384 }
385 default: { 385 default: {
386 auto len = lua_objlen(L, tableIndex); 386 auto len = static_cast<int>(lua_objlen(L, tableIndex));
387 lua_createtable(L, count + 3, 0); 387 lua_createtable(L, count + 3, 0);
388 getName(node); 388 getName(node);
389 lua_rawseti(L, -2, 1); 389 lua_rawseti(L, -2, 1);
@@ -400,7 +400,7 @@ static int yuetoast(lua_State* L) {
400 lua_rawseti(L, tableIndex, len); 400 lua_rawseti(L, tableIndex, len);
401 len--; 401 len--;
402 } 402 }
403 lua_rawseti(L, tableIndex, lua_objlen(L, tableIndex) + 1); 403 lua_rawseti(L, tableIndex, static_cast<int>(lua_objlen(L, tableIndex)) + 1);
404 break; 404 break;
405 } 405 }
406 } 406 }
@@ -422,9 +422,9 @@ static int yuetoast(lua_State* L) {
422 422
423static int yueisast(lua_State* L) { 423static int yueisast(lua_State* L) {
424 size_t nameLen = 0; 424 size_t nameLen = 0;
425 auto name = luaL_tolstring(L, 1, &nameLen); 425 auto name = lua_tolstring(L, 1, &nameLen);
426 size_t codeLen = 0; 426 size_t codeLen = 0;
427 auto code = luaL_tolstring(L, 2, &codeLen); 427 auto code = lua_tolstring(L, 2, &codeLen);
428 bool result = yue::YueParser::shared().match({name, nameLen}, {code, codeLen}); 428 bool result = yue::YueParser::shared().match({name, nameLen}, {code, codeLen});
429 lua_pushboolean(L, result ? 1 : 0); 429 lua_pushboolean(L, result ? 1 : 0);
430 return 1; 430 return 1;