Re: [code] Advice on using external libraries in textadept modules

From: Mitchell <m.att.foicica.com>
Date: Tue, 25 Apr 2017 19:55:31 -0400 (EDT)

Hi Stefan,

On Tue, 25 Apr 2017, Stefan Thesing wrote:

> Hi everyone,
>
> I'm working on a Textadept module and I'd like to use the lyaml library
> (https://gvvaughan.github.io/lyaml/).
>
> I had some trouble getting it to run. At first I thought it's because
> Textadept runs on Lua 5.3 and Ubuntu installed lyaml for Lua 5.2.
>
> Now I used luarocks to install it for 5.3, and it works outside Textadept.
> However, when I require lyaml from my module init.lua file, I still get an
> error message: "/usr/share/lua/5.3/lyaml.lua:31: module 'yaml' not found:"
>
> Textadept seems to find lyaml, now, but not the LibYAML library (yaml.so)
> that lyaml tries to access.
>
> Am I right that Textadept uses a different Lua 5.3 environment than my system
> does? If so, is there a way to change that?

Textadept uses its own Lua 5.3 runtime, rather than any runtime on the
current system. Textadept can still load Lua 5.3 modules on the system
though. You just have to make sure the `package.path` and `package.cpath`
variables are set properly.

> I tried to place a symlink to the yaml.so file in my .textadept folder,
> because the rest of the error message suggested that TA might look for it
> there (saying "no file '/home/sthesing/.textadept/yaml.so'" amongst other
> paths), but to no avail.
>
> So my question is: how would you advise to use external libraries like lyaml
> in Textadept modules?

As I mentioned, it should be as simple as setting Textadept's
`package.path` and `package.cpath` properly to look for the system's
modules. However, it appears you've tried at least putting the `.so` file
into the default `package.cpath`. If you provided the exact locations and
exact error messages, that might be of more help.

If all you need is lyaml, you might want to try downloading Textadept's
set of language modules (available as a separate download from the main
page). It includes a YAML language module which also includes lyaml.

Cheers,
Mitchell

-- 
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 Tue 25 Apr 2017 - 19:55:31 EDT

This archive was generated by hypermail 2.2.0 : Wed 26 Apr 2017 - 06:40:54 EDT