Sorry for not seeing this post. I should fix my email filters somehow to make luvit posts show out.
So this is actually an area of active development. I recently ported lit's entire code base to not depend on the luvit require module and instead use a custom lua loader to give luvit-style path resolution to lua's native require function. So when making your own luvi app from scratch, you have two options: 1. Make sure that `deps/require.lua` contains the luvit/require package. Luvi will see this and automatically take over lua's require system. 2. Use luvit-loader.lua as lit does. In a luvi app, bootstrapping luvit-loader is fairly simple: https://github.com/luvit/lit/blob/master/main.lua#L19-L20 Just make sure that luvit-loader is in the path you tell it to be at. https://github.com/luvit/lit/blob/master/luvit-loader.lua With either path, you'll need all your dependencies installed to the `deps` folder in your luvi app. This can be done easily enough using the lit tool. lit install creationix/weblit Running that command in your luvi app will download weblit and all it's dependencies and install them to `deps/*`. Then both luvit style require systems can find them. If you go the luvit-loader route (And I suggest this for any new app), then you can also freely mix in luarocks packages, though this is probably a bad idea for luvi based apps since you intend to eventually deploy them as a single binary and those deps won't be included. Note that luvit-loader works great with plain lua or luajit apps as well. I'm currently working on a new service for my work that runs entirely with luajit using luv from luarocks and everything else from lit installed to deps. See https://github.com/virgo-agent-toolkit/super-agent/blob/30d1ef5789282b32ccb2a9604e12026f7e15366e/api/main.lua On Sun, Feb 14, 2016 at 3:46 PM, Mateusz Czapliński <[email protected]> wrote: > I want to start building an app based on the luvi runtime, but I'm having > trouble wrapping my head around how to reference (require) various > fragments of the luvi/luvit ecosystem... > > Specifically, I want to write an app which (among others) uses a forked > repl.lua "module" (with some patches). > > For starters, I've tried to do it as follows: > 1. downloaded luvi-regular-Windows-amd64.exe (and renamed to luvi.exe); > 2. downloaded > https://github.com/luvit/luvit/blob/58fce31c1fd0bbeb53506a8848ca364dbdfc02de/deps/repl.lua > and saved it as 'repl.lua'; > 3. tried to create 'main.lua' as below: > > local uv = require('uv') > local bundle = require('luvi').bundle > local utils = require('utils') > > -- (Based on https:// > github.com/luvit/luvi/blob/master/samples/repl.app/main.lua) > -- Register some local Lua scripts as libraries > bundle.register("repl", "repl.lua") > > local c = utils.color > local greeting = "Welcome to " ..c('err').. 'shiny' ..c().. " repl!" > require('repl')(utils.stdin, utils.stdout, greeting).start("", function() > end) > > -- This blocks > uv.run() > > > 4. Tried running it with luvi.exe, but getting error as below: > > C:\prog\shiny2>luvi . > [string "bundle:main.lua"]:3: module 'utils' not found: > no field package.preload['utils'] > no file 'c:\luarocks\2.2\lua\utils.lua' > no file 'c:\luarocks\2.2\lua\utils\init.lua' > no file 'c:\luarocks\share\lua\5.1\utils.lua' > no file 'c:\luarocks\share\lua\5.1\utils\init.lua' > no file 'c:\luarocks\lib\lua\5.1\utils.dll' > > 5. How should I resolve this? > 6. Also, I'm confused about e.g. module "timer": on > https://luvit.io/api/timer.html, it seems mentioned one should use `local > timer = require('timer')`; but this doesn't work in my main.lua; instead, > the "hello world" example on https://github.com/luvit/luvi (it worked for > me) uses `uv.new_timer(...)`, that I don't even know where it's > documented... ? > > halp, plz? I haz stuck :/ and can't really theorize wat the fancy should I > try next anymore :/ > > TIA > /M. > > -- > You received this message because you are subscribed to the Google Groups > "luvit" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "luvit" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
