aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/yuescript/yuescript.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/yuescript/yuescript.cpp b/src/yuescript/yuescript.cpp
index 20fa258..ed09aaa 100644
--- a/src/yuescript/yuescript.cpp
+++ b/src/yuescript/yuescript.cpp
@@ -161,7 +161,7 @@ struct yue_stack {
161static int yuetoast(lua_State* L) { 161static int yuetoast(lua_State* L) {
162 size_t size = 0; 162 size_t size = 0;
163 const char* input = luaL_checklstring(L, 1, &size); 163 const char* input = luaL_checklstring(L, 1, &size);
164 int flattenLevel = 2; 164 int flattenLevel = 0;
165 if (lua_isnoneornil(L, 2) == 0) { 165 if (lua_isnoneornil(L, 2) == 0) {
166 flattenLevel = static_cast<int>(luaL_checkinteger(L, 2)); 166 flattenLevel = static_cast<int>(luaL_checkinteger(L, 2));
167 flattenLevel = std::max(std::min(2, flattenLevel), 0); 167 flattenLevel = std::max(std::min(2, flattenLevel), 0);
@@ -270,8 +270,10 @@ static int yuetoast(lua_State* L) {
270 lua_pushinteger(L, node->m_begin.m_col); 270 lua_pushinteger(L, node->m_begin.m_col);
271 lua_rawseti(L, -2, 3); 271 lua_rawseti(L, -2, 3);
272 for (int i = count, j = 4; i >= 1; i--, j++) { 272 for (int i = count, j = 4; i >= 1; i--, j++) {
273 lua_rawgeti(L, tableIndex, len); 273 lua_rawgeti(L, tableIndex, len - i + 1);
274 lua_rawseti(L, -2, j); 274 lua_rawseti(L, -2, j);
275 }
276 for (int i = 1; i <= count; i++) {
275 lua_pushnil(L); 277 lua_pushnil(L);
276 lua_rawseti(L, tableIndex, len); 278 lua_rawseti(L, tableIndex, len);
277 len--; 279 len--;