lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

于 2011-8-26 21:44, Lorenzo Donati 写道:
Hi All!

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/" or "ROOT\lpeg\lpeg.dll"