0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 7.4.1154

Problem:    No support for JSON.
Solution:   Add jsonencode() and jsondecode().  Also add v:false, v:true,
            v:null and v:none.
This commit is contained in:
Bram Moolenaar
2016-01-23 19:46:28 +01:00
parent 6920c72d4d
commit 520e1e41f3
28 changed files with 863 additions and 34 deletions

View File

@@ -499,6 +499,12 @@ luaV_pushtypval(lua_State *L, typval_T *tv)
case VAR_DICT:
luaV_pushdict(L, tv->vval.v_dict);
break;
case VAR_SPECIAL:
if (tv->vval.v_number <= VVAL_TRUE)
lua_pushinteger(L, (int) tv->vval.v_number);
else
lua_pushnil(L);
break;
default:
lua_pushnil(L);
}
@@ -510,7 +516,7 @@ luaV_totypval (lua_State *L, int pos, typval_T *tv)
{
switch(lua_type(L, pos)) {
case LUA_TBOOLEAN:
tv->v_type = VAR_NUMBER;
tv->v_type = VAR_SPECIAL;
tv->vval.v_number = (varnumber_T) lua_toboolean(L, pos);
break;
case LUA_TSTRING: