[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: External modules was Re: Ideas for implementing commercial support for Lua
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 18 Nov 2002 09:34:57 +0000
> Luiz, it would be nice if the loadlib code were platform independant
> from the lua side, that is, in unix it would look like:
Currently, our idea is to put the minimum in C, and everything else in
Lua. Typically, each module in C would have a companion file in Lua:
this Lua file could be very small, more or less like this:
-- Lua file for module Xuxu: xuxu.lua
-- Config part; set to your system
local libdir = "/usr/local/lua/"
local modname = "xuxu.so"
local f = loadlib(libdir..modname, "xuxuopen")
if not f then error (...) end
f() -- open module
You put xuxu.so anywhere, adjust xuxu.lua, and put xuxu.lua in a
directory on your LUA_PATH; than you use it as
require "xuxu"
For the user, it doesn't matter whether this is a C module or a Lua
module (or a mixed one).
-- Roberto