[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Tidying up search path for C modules.
- From: Should Pain <pengzhicheng1986@...>
- Date: Sat, 27 Aug 2011 22:58:47 +0800
于 2011-8-26 21:44, Lorenzo Donati 写道:
Some time ago I wanted to clean up my C search path, which began looking as a trash bin full of unrelated DLLs side by side to lua.exe.
I tried to put different libraries in different subdirs, but then for example this idiom didn't work any longer:
local lfs = require 'lfs'
if I did not mis-understood you, maybe what you could try is like this (see the document for `package.cpath'):
> -- suppose you have already set the variable `root'
> -- ROOT = "/"
> package.cpath = ROOT .. "/?/?.dll" .. package.cpath
> -- or for windows, maybe use this form
> package.cpath = ROOT .. "\\?\\?.dll" .. package.cpath
then, this statement
> require "lpeg"
would just load "ROOT/lpeg/lpeg.so" or "ROOT\lpeg\lpeg.dll"