diff options
author | Mark Pulford <mark@kyne.com.au> | 2012-01-19 00:19:47 +1030 |
---|---|---|
committer | Mark Pulford <mark@kyne.com.au> | 2012-03-04 18:54:35 +1030 |
commit | 88bb249473db4e4923e4c27a8e3ece7a77e738ce (patch) | |
tree | 9c7d5d537fb539aca1f17b75c7296d1f6489de22 /lua_cjson.c | |
parent | 1a5460be319ac29af31f201fbf9775340262ba9b (diff) | |
download | lua-cjson-88bb249473db4e4923e4c27a8e3ece7a77e738ce.tar.gz lua-cjson-88bb249473db4e4923e4c27a8e3ece7a77e738ce.tar.bz2 lua-cjson-88bb249473db4e4923e4c27a8e3ece7a77e738ce.zip |
Disable registration of cjson global variable
Disable registration of cjson module table global variable in the
default build. Automatically creating a variable in the global namespace
can cause issues for other software and is no longer recommended with
Lua.
Diffstat (limited to 'lua_cjson.c')
-rw-r--r-- | lua_cjson.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/lua_cjson.c b/lua_cjson.c index 0662414..118ca27 100644 --- a/lua_cjson.c +++ b/lua_cjson.c | |||
@@ -1382,13 +1382,8 @@ int luaopen_cjson(lua_State *l) | |||
1382 | { | 1382 | { |
1383 | lua_cjson_new(l); | 1383 | lua_cjson_new(l); |
1384 | 1384 | ||
1385 | #if !defined(DISABLE_CJSON_GLOBAL) && (!defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502) | 1385 | #ifdef ENABLE_CJSON_GLOBAL |
1386 | /* Register a global "cjson" table to maintain compatibility with earlier | 1386 | /* Register a global "cjson" table. */ |
1387 | * versions of Lua CJSON which used luaL_register() under Lua 5.1. | ||
1388 | * | ||
1389 | * From Lua 5.2 onwards, Lua CJSON does not automatically register a global | ||
1390 | * table. | ||
1391 | */ | ||
1392 | lua_pushvalue(l, -1); | 1387 | lua_pushvalue(l, -1); |
1393 | lua_setglobal(l, CJSON_MODNAME); | 1388 | lua_setglobal(l, CJSON_MODNAME); |
1394 | #endif | 1389 | #endif |