Hi Tim!

Thanks for the reply. In the meantime, I thought I could maybe try
using the "luvit" app for initial prototyping, assuming it would have
all the kinds of modules built-in. And after a few more tries, it
finally worked for me!

Unfortunately, after some more prototyping, I stumbled into two new problems:

1. Firstly, I had an issue with the REPL on Windows, specifically with
wrapping of lines. When a chunk in REPL exceeded terminal width, the
readline wrapper started positioning the cursor wrongly, and
duplicating the first Iine on each keypress. It's hard to describe,
much easier to see, but I didn't try to put effort into recording it
yet, not sure if you'd care enough a fix it?

Also, while researching it, I found that node.js struggled with a
similar issue on Windows - the root cause seems to be different
behavior of Windows console APIs vs. Linux terminal APIs w.r.t.
overflowing lines, and requires an explicit switch on OS. I wasn't
motivated enough to analyze the luvit's readIine-wrapping code to find
out how it works (without comments) and how to fix it. I'd be happy to
try recording a video showing the problem and to find the github issue
# in node.js if you'd be willing to try fixing it.

2. Secondly, I found out that luvit/node.js API doesn't seem to handle
http cookies automatically, which was a problem for me.

The two problems listed above, taken together, were annoying enough
for me, that I scratched my project for now, so I'm not exploring
luvit more at the time being. That said, having the REPL fixed would
be very nice for me. With cookies I can try fighting then.

As to packaging and LuaRocks... it's another story for me. So, I love
the general idea of LuaRocks, but unfortunately I find them annoying
to work with on Windows (I mean especially the installer). That's
actually one of the things which led me to luvit - where you seemed to
execute it in a more
user-friendly way with lit (at least in my eyes). So, if you'd maybe consider
making a lit-like client for LuaRocks, that's something I'd personally
love. But just saying; do whatever you like, I'm absolutely not one of
the guys with demands :)

As a side-effect of my experiment, I've created a build script for
luvit.exe and lit.exe, which to me seems simpler than the instructions
on github - see:
  https://gist.github.com/akavel/3e048ce47374f878afb3
This one makes use of the luvi's "self contained binaries creation"
feature, which is the second (or maybe even first?) major feature that
made luvi attractive to me initially.

So, that's my current situation, plus some feedback I thought I could
give you, thinking it might potentially be interesting to you.

Best Regards,
/Mateusz.

On Tue, Feb 16, 2016 at 7:13 PM, Tim Caswell <[email protected]> wrote:
> 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 a topic in the
> Google Groups "luvit" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/luvit/WpJLGMVEYfQ/unsubscribe.
> To unsubscribe from this group and all its topics, 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.

Reply via email to