Hi,

Been following, using , and hacking on Luvit and Luvi for some time now. I 
was a tad devastated when it broke into separate components, and took a 
break for a bit. I am a huge fan of the project, not so much a fan of the 
documentation. (As an aside, I am trying to pitch in on docs. I just 
started moving over info from libuv to luv.readthedocs.org. Still a work in 
progress as I learn the conversions to Lua).

A while back I had inquired about how to properly "require" an external Lua 
based module. I had dug through the samples at the time and had found 
*bundle.register*, which seemed to be the only way to get my modules loaded 
(even though they are sitting in the the root app folder!?). I was told 
*not* to use this method because it was going to change.

Well, it doesn't seem like anything has changed. I've tried every which 
way, but cannot use "require" as it is currently. Even for the simplest use 
cases. The *bundle.register* is the only working method.

Here is my trivial test example:

app/
  main.lua
  greeting.lua

*--app/main.lua*
*local env = require('env')*
*local uv  = require('uv')*

*local greeting = require('greeting')*

*print('main')*
*greeting.greet()*

*--app/greeting.lua*
*local m = {}*

*function m.greeting()*
*  print('hello again!')*
*end*

*return m*

--> OUTPUTS:

Users-MacBook-Pro:testy coronium$ luvi app
[string "bundle:main.lua"]:6: module 'greeting' not found:
no field package.preload['greeting']
no file '/usr/local/share/lua/5.1/greeting.lua'
no file '/usr/local/share/lua/5.1/greeting/init.lua'
no file '/usr/local/Cellar/lua51/5.1.5_2/libexec/share/lua/5.1/greeting.lua'
*no file './greeting$' <-- Seems like this should pick up the module?*
no file '/usr/local/lib/lua/5.1/greeting.so'
no file './greeting.so'
no file '/usr/local/lib/lua/5.1/loadall.so'

  
If I throw in the *bundle.register('greeting', 'greeting.lua')* it will 
work fine.

--> OUTPUTS: 
 
Users-MacBook-Pro:testy coronium$ luvi app
main
hello again!


So what is the proper method? I've tried a lot of different angles, and 
appear to have no other options to try.

Thanks in advance.



-- 
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