lua-users home
lua-l archive

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


Thanks for the quick reply Yuri.

On 15/05/2009, at 10:04 AM, Yuri Takhteyev wrote:

I just installed luarocks through macports, and it all seems to be working fine - much easier than all the build-it-myself that I'd been doing before.

Great. This should method should get documented somewhere.

That was easy: "sudo port install luarocks". Thanks, according to macports, are due to Andrea Damore.

lua -lluarocks.require script.lua

You can put require("luarocks.require") inside the script.

Yep, I understood that. I'm just trying to be lazy. LUA_INIT looks like the way to go

$ LUA_INIT="require'luarocks.require'" lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> require"lfs"
(no error!)

Also, I installed markdown.lua with luarocks. What now? I used to go "lua markdown.lua file.txt" or even "markdown.lua file.txt", but now the best

This may also answer the previous question: LR can install a package
just as a library or as executable scripts. I believe the rockspec for
markdown assumes you'll only be using it as a library. This is not an
inherent limitation of LR, but of the markdown rockspec. With a proper
rockspec, you should be able to just run it with .../bin/markdown.lua
file.txt - i.e., LR would put the necessary paths inside
.../bin/markdown.lua.

I can't quite work out how to do this in a rockspec and certainly not cross platformly, but it seems that a link is needed from ...luarocks \rocks\markdown\...\lua\markdown.lua to ...\luarocks\bin\, and permissions on markdown.lua need a "+x". Then it turned out that OS X barfed on the "#!/usr/bin/env lua" because markdown.lua had windows line ends. It's all working now though!

Cheers,
Geoff