--- lua-5.3.4/src/lua.c 2017年01月12日 19:14:26.000000000 +0200 +++ /usr/local/src/lua-5.3.4/src/lua.c 2017年04月20日 09:56:45.934110199 +0200 @@ -256,13 +256,18 @@ ** Calls 'require(name)' and stores the result in a global variable ** with the given name. */ -static int dolibrary (lua_State *L, const char *name) { +static int dolibrary (lua_State *L, char *name) { int status; - lua_getglobal(L, "require"); - lua_pushstring(L, name); + char *eq = strchr(name,'='); + lua_getglobal(L, "require"); + if (eq) lua_pushstring(L, eq+1); + else lua_pushstring(L, name); status = docall(L, 1, 1); /* call 'require(name)' */ - if (status == LUA_OK) + if (status == LUA_OK) { + if (eq) *eq=0; lua_setglobal(L, name); /* global[name] = require return */ + if (eq) *eq='='; + } return report(L, status); }