Re: [code] [textadept] Textadept 8.0 alpha

From: Chris Emerson <c-ta.att.mail.nosreme.org>
Date: Tue, 14 Apr 2015 00:04:47 +0100

Hi Mitchell,

On Mon, Apr 13, 2015 at 11:21:19AM -0400, Mitchell wrote:
[Error on require'lfs' in luajit]
> It appears to have been introduced in lfs 1.6.2, at least 9 months
> ago, but I'm not sure how. I don't know enough about Lua 5.1/LuaJITs
> module architecture to fix this.
>
> If anyone can supply a patch (probably against lfs itself), I'll
> commit it to Textadept's build process.

The following (which effectively undoes one of the changes from 1.6.2 for
LuaJIT) works for me:

--- lfs_new.c 2015-04-13 23:59:13.753907722 +0100
+++ lua/src/lib/lfs.c 2015-04-13 23:57:40.646725316 +0100
@@ -890,9 +890,13 @@
 int luaopen_lfs (lua_State *L) {
         dir_create_meta (L);
         lock_create_meta (L);
+#if LUA_VERSION_NUM < 502
+ luaL_register(L, "lfs", fslib);
+#else
         luaL_newlib (L, fslib);
         lua_pushvalue(L, -1);
         lua_setglobal(L, LFS_LIBNAME);
+#endif
         set_info (L);
         return 1;
 }

It looks like luaL_register() with a non-NULL second argument is what sets
up package.loaded (making require work) on LuaJIT.

I noticed that at least utf8 has the same issue in textadeptjit-curses, but
it's too late for me to look into it right now. :-) I suspect it'll be the
same kind of thing.

Regards,

Chris

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Mon 13 Apr 2015 - 19:04:47 EDT

This archive was generated by hypermail 2.2.0 : Tue 14 Apr 2015 - 06:33:38 EDT