From owner-svn-src-head@freebsd.org Sun Feb 18 01:13:59 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23607F24D21; Sun, 18 Feb 2018 01:13:59 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CB29478A8C; Sun, 18 Feb 2018 01:13:58 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C60BD2498E; Sun, 18 Feb 2018 01:13:58 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1I1DwSD087359; Sun, 18 Feb 2018 01:13:58 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1I1DwJl087356; Sun, 18 Feb 2018 01:13:58 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201802180113.w1I1DwJl087356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sun, 18 Feb 2018 01:13:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329499 - in head/stand: common liblua X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/stand: common liblua X-SVN-Commit-Revision: 329499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Feb 2018 01:13:59 -0000 Author: cem Date: Sun Feb 18 01:13:58 2018 New Revision: 329499 URL: https://svnweb.freebsd.org/changeset/base/329499 Log: interp_lua: Register io/loader with regular Lua module system Reviewed by: kevans Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D14421 Modified: head/stand/common/interp_lua.c head/stand/liblua/lutils.c head/stand/liblua/lutils.h Modified: head/stand/common/interp_lua.c ============================================================================== --- head/stand/common/interp_lua.c Sun Feb 18 01:01:15 2018 (r329498) +++ head/stand/common/interp_lua.c Sun Feb 18 01:13:58 2018 (r329499) @@ -85,6 +85,8 @@ static const luaL_Reg loadedlibs[] = { // {LUA_MATHLIBNAME, luaopen_math}, // {LUA_UTF8LIBNAME, luaopen_utf8}, // {LUA_DBLIBNAME, luaopen_debug}, + {"io", luaopen_io}, + {"loader", luaopen_loader}, {NULL, NULL} }; @@ -105,7 +107,6 @@ interp_init(void) abort(); } softc->luap = luap; - register_utils(luap); /* "require" functions from 'loadedlibs' and set results to global table */ for (lib = loadedlibs; lib->func; lib++) { Modified: head/stand/liblua/lutils.c ============================================================================== --- head/stand/liblua/lutils.c Sun Feb 18 01:01:15 2018 (r329498) +++ head/stand/liblua/lutils.c Sun Feb 18 01:13:58 2018 (r329499) @@ -233,11 +233,15 @@ static const struct luaL_Reg iolib[] = { }; #undef REG_SIMPLE -void -register_utils(lua_State *L) +int +luaopen_loader(lua_State *L) { luaL_newlib(L, loaderlib); - lua_setglobal(L, "loader"); - luaL_newlib(L, iolib); - lua_setglobal(L, "io"); + return 1; } + +int +luaopen_io(lua_State *L) +{ + luaL_newlib(L, iolib); + return 1; Modified: head/stand/liblua/lutils.h ============================================================================== --- head/stand/liblua/lutils.h Sun Feb 18 01:01:15 2018 (r329498) +++ head/stand/liblua/lutils.h Sun Feb 18 01:13:58 2018 (r329499) @@ -28,4 +28,5 @@ #include -void register_utils(lua_State *); +int luaopen_loader(lua_State *); +int luaopen_io(lua_State *);