core.lua (bac5966e2d1b4cd7cb4d0cfab7a013d2af8054e5) | core.lua (366f9979bb1e4688735b0f6e0ad1549f0253c5d0) |
---|---|
1-- 2-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3-- 4-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org> 5-- Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org> 6-- All rights reserved. 7-- 8-- Redistribution and use in source and binary forms, with or without --- 56 unchanged lines hidden (view full) --- 65end 66 67 68-- Globals 69-- try_include will return the loaded module on success, or false and the error 70-- message on failure. 71function try_include(module) 72 if module:sub(1, 1) ~= "/" then | 1-- 2-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3-- 4-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org> 5-- Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org> 6-- All rights reserved. 7-- 8-- Redistribution and use in source and binary forms, with or without --- 56 unchanged lines hidden (view full) --- 65end 66 67 68-- Globals 69-- try_include will return the loaded module on success, or false and the error 70-- message on failure. 71function try_include(module) 72 if module:sub(1, 1) ~= "/" then |
73 local lua_path = loader.lua_paths | 73 local lua_path = loader.lua_path |
74 -- XXX Temporary compat shim; this should be removed once the 75 -- loader.lua_path export has sufficiently spread. 76 if lua_path == nil then 77 lua_path = "/boot/lua" 78 end 79 module = lua_path .. "/" .. module 80 -- We only attempt to append an extension if an absolute path 81 -- wasn't specified. This assumes that the caller either wants --- 333 unchanged lines hidden --- | 74 -- XXX Temporary compat shim; this should be removed once the 75 -- loader.lua_path export has sufficiently spread. 76 if lua_path == nil then 77 lua_path = "/boot/lua" 78 end 79 module = lua_path .. "/" .. module 80 -- We only attempt to append an extension if an absolute path 81 -- wasn't specified. This assumes that the caller either wants --- 333 unchanged lines hidden --- |