+8
-1
lines changedFilter options
+8
-1
lines changed Original file line number Diff line number Diff line change
@@ -1242,7 +1242,12 @@ LuaRef nlua_pop_LuaRef(lua_State *const lstate, Error *err)
1242
1242
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT \
1243
1243
{ \
1244
1244
type ret; \
1245
-
ret = (type)lua_tonumber(lstate, -1); \
1245
+
if (lua_type(lstate, -1) != LUA_TNUMBER) { \
1246
+
api_set_error(err, kErrorTypeValidation, "Expected Lua number"); \
1247
+
ret = (type)-1; \
1248
+
} else { \
1249
+
ret = (type)lua_tonumber(lstate, -1); \
1250
+
} \
1246
1251
lua_pop(lstate, 1); \
1247
1252
return ret; \
1248
1253
}
Original file line number Diff line number Diff line change
@@ -183,6 +183,8 @@ describe('luaeval(vim.api.…)', function()
183
183
remove_trace(exc_exec([[call luaeval("vim.api.nvim_buf_get_lines(0, 'test', 1, false)")]])))
184
184
eq('Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Number is not integral',
185
185
remove_trace(exc_exec([[call luaeval("vim.api.nvim_buf_get_lines(0, 1.5, 1, false)")]])))
186
+
eq('Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Expected Lua number',
187
+
remove_trace(exc_exec([[call luaeval("vim.api.nvim_win_is_valid(nil)")]])))
186
188
187
189
eq('Vim(call):E5108: Error executing lua [string "luaeval()"]:1: Expected lua table',
188
190
remove_trace(exc_exec([[call luaeval("vim.api.nvim__id_float('test')")]])))
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4