[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaSocket and require
- From: David Burgess <dburgess@...>
- Date: Tue, 30 Nov 2004 23:29:34 +1000
I preprocess LuaSocket with the C preprocessor to change require()
to socketrequire. This gets around the immediate problem.
Diego's is committed to providing compatiblilty with the Lua 5.1
"package" proposal, so I think you can expect future compatibility.
In the meantime try the preprocessor.
On Tue, 30 Nov 2004 12:29:31 +0000, David Given <email@example.com> wrote:
> I'm getting LuaSocket working on my system, and have run across some problems
> due to the way it uses require.
> Normally, Lua plugins work by you doing 'require "pluginname"', and it creates
> a table in the current environment called "pluginname" containing the
> plugin's symbols.
> LuaSocket overrides require with its own version that merely returns the
> table. It doesn't install it in the environment. It seems to want you to do
> 'pluginname = require "pluginname"' instead.
> Naturally, these two version of require are completely incompatible! I'm faced
> with the choice of either (a) rewriting all third-party Lua code to use
> LuaSocket's new version of require, or (b) rewriting LuaSocket to use the
> more conventional version of require. I don't really want to do either,
> because the more I touch third-party code, the more effort I'm going to have
> to put in to upgrade it.
> Has anyone else had to tackle this? If so, what did you do? Is there a
> standard for this kind of thing?
> +- David Given --McQ-+ "Gaping from its single obling socket was
> | firstname.lastname@example.org | scintillating, many fauceted scarlet emerald..."
> | (email@example.com) | --- Jim Theis, _The Eye of Argon_ (spelling
> +- www.cowlark.com --+ original)