From 88bb249473db4e4923e4c27a8e3ece7a77e738ce Mon Sep 17 00:00:00 2001 From: Mark Pulford Date: Thu, 19 Jan 2012 00:19:47 +1030 Subject: 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. --- lua_cjson.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'lua_cjson.c') 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) { lua_cjson_new(l); -#if !defined(DISABLE_CJSON_GLOBAL) && (!defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502) - /* Register a global "cjson" table to maintain compatibility with earlier - * versions of Lua CJSON which used luaL_register() under Lua 5.1. - * - * From Lua 5.2 onwards, Lua CJSON does not automatically register a global - * table. - */ +#ifdef ENABLE_CJSON_GLOBAL + /* Register a global "cjson" table. */ lua_pushvalue(l, -1); lua_setglobal(l, CJSON_MODNAME); #endif -- cgit v1.2.3-55-g6feb