Mateusz Czapliński
2016-02-14 21:46:51 UTC
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.
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 luvit+***@googlegroups.com.
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 luvit+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.