Use local variables as to not leak them to user context
This commit is contained in:
parent
6b541836e1
commit
293cae4b06
@ -1,9 +1,9 @@
|
|||||||
# $OpenBSD: Makefile,v 1.15 2005/04/27 16:41:11 pedro Exp $
|
# $OpenBSD: Makefile,v 1.16 2005/12/10 23:02:05 pedro Exp $
|
||||||
|
|
||||||
COMMENT= "powerful, light-weight programming language"
|
COMMENT= "powerful, light-weight programming language"
|
||||||
|
|
||||||
DISTNAME= lua-5.0.2
|
DISTNAME= lua-5.0.2
|
||||||
PKGNAME= ${DISTNAME}p1
|
PKGNAME= ${DISTNAME}p2
|
||||||
CATEGORIES= lang
|
CATEGORIES= lang
|
||||||
|
|
||||||
MASTER_SITES= http://www.lua.org/ftp/ \
|
MASTER_SITES= http://www.lua.org/ftp/ \
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
-- $OpenBSD: init.lua,v 1.2 2005/04/19 14:31:27 pedro Exp $
|
-- $OpenBSD: init.lua,v 1.3 2005/12/10 23:02:05 pedro Exp $
|
||||||
-- Written by Pedro Martelletto <pedro@openbsd.org> in 2004. Public domain.
|
-- Written by Pedro Martelletto <pedro@openbsd.org> in 2004. Public domain.
|
||||||
|
|
||||||
-- add an entry to a path list
|
-- add an entry to a path list
|
||||||
@ -32,8 +32,8 @@ lua_addcpath(entry)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- get the package table
|
-- get the package table
|
||||||
f = assert(loadfile("@pkgconf@"))
|
local f = assert(loadfile("@pkgconf@"))
|
||||||
setfenv(f, {}) f() pt = getfenv(f).installed_packages
|
setfenv(f, {}) f() local pt = getfenv(f).installed_packages
|
||||||
|
|
||||||
-- iterate over the table, loading each package
|
-- iterate over the table, loading each package
|
||||||
for i, v in pt do
|
for i, v in pt do
|
||||||
@ -46,7 +46,6 @@ end
|
|||||||
-- finally, run user's initialization file, if it exists
|
-- finally, run user's initialization file, if it exists
|
||||||
local f = loadfile((os.getenv("HOME") or "") .. "/.lua/init.lua")
|
local f = loadfile((os.getenv("HOME") or "") .. "/.lua/init.lua")
|
||||||
if f then f() end
|
if f then f() end
|
||||||
f = nil
|
|
||||||
|
|
||||||
lua_addpath("?;?.lua") -- set the default path
|
lua_addpath("?;?.lua") -- set the default path
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user