Problem to import module in eLua - LM3S

classic Classic list List threaded Threaded
5 messages Options
Marcus Vinicius Costa Marcus Vinicius Costa
Reply | Threaded
Open this post in threaded view
|

Problem to import module in eLua - LM3S

Hi all...

It has to do something different to import modules in eLua, I put in my code the "require", but always i have a error in the execution.

Source in file "main.lua"
...
require "http"
...

-- In terminal using a IDE Goat
With the LS command I list all files in mmc card and the 2 files found are correct, "main.lua" and "http.lua".

    eLua v0.8  Copyright (C) 2007-2011 www.eluaproject.net
    eLua# ls

    /rom
    Total on /rom: 0 bytes


    /mmc
    http.lua                       5439 bytes
    main.lua                       7799 bytes
    Total on /mmc: 13238 bytes

When I run the file "main.lua" an error occurs and says that the module was not found

    eLua# lua /mmc/main.lua
    Press CTRL+Z to exit Lua
    lua: /mmc/main.lua:87: module 'http' not found:
            no field package.preload['http']
            no file '/mmc/http.lua'
            no file '/mmc/http.lc'
            no file '/rom/http.lua'
            no file '/rom/http.lc'
    stack traceback:
            [C]: in function 'require'
            /mmc/main.lua:87: in main chunk
            [C]: ?

After the error, if I ask to list the files again nothing is found, as if the card was "ejected" by the system, only to reset it back to normal.

    eLua# ls

    /rom
    Total on /rom: 0 bytes
    /mmc
    Total on /mmc: 0 bytes

    eLua#

Someone tell me what might be happening to him can not find the module, what can I do to try to solve the problem?

Thanks in advance by the help
Marcus Vinicius

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Re: Problem to import module in eLua - LM3S

Hi,

On Wed, Apr 11, 2012 at 3:18 PM, Marcus Vinicius Costa
<[hidden email]> wrote:

> Hi all...
>
> It has to do something different to import modules in eLua, I put in my code
> the "require", but always i have a error in the execution.
>
> Source in file "main.lua"
> ...
> require "http"
> ...
>
> -- In terminal using a IDE Goat
> With the LS command I list all files in mmc card and the 2 files found are
> correct, "main.lua" and "http.lua".
>
>     eLua v0.8  Copyright (C) 2007-2011 www.eluaproject.net
>     eLua# ls
>
>     /rom
>     Total on /rom: 0 bytes
>
>
>     /mmc
>     http.lua                       5439 bytes
>     main.lua                       7799 bytes
>     Total on /mmc: 13238 bytes
>
> When I run the file "main.lua" an error occurs and says that the module was
> not found
>
>     eLua# lua /mmc/main.lua
>     Press CTRL+Z to exit Lua
>     lua: /mmc/main.lua:87: module 'http' not found:
>             no field package.preload['http']
>             no file '/mmc/http.lua'
>             no file '/mmc/http.lc'
>             no file '/rom/http.lua'
>             no file '/rom/http.lc'
>     stack traceback:
>             [C]: in function 'require'
>             /mmc/main.lua:87: in main chunk
>             [C]: ?
>
> After the error, if I ask to list the files again nothing is found, as if
> the card was "ejected" by the system, only to reset it back to normal.
>
>     eLua# ls
>
>     /rom
>     Total on /rom: 0 bytes
>     /mmc
>     Total on /mmc: 0 bytes
>
>     eLua#
>
> Someone tell me what might be happening to him can not find the module, what
> can I do to try to solve the problem?

That sounds like an SD card issue. Have you tried a different SD card?
What happens if you do 'cat /mmc/http.lua' ?

Best,
Bogdan

>
> Thanks in advance by the help
> Marcus Vinicius
>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Marcus Vinicius Costa Marcus Vinicius Costa
Reply | Threaded
Open this post in threaded view
|

Re: Problem to import module in eLua - LM3S

Hi Bogdan, thanks for the prompt response.

I have tested with 2 differents SD cards and i try to send the files direct by terminal and using a PC with windows, but i have the same problem in both...

I will test the command 'cat /mmc/http.lua' to see the result.

Thanks
Marcus Vinicius

2012/4/11 Bogdan Marinescu <[hidden email]>
Hi,

On Wed, Apr 11, 2012 at 3:18 PM, Marcus Vinicius Costa
<[hidden email]> wrote:
> Hi all...
>
> It has to do something different to import modules in eLua, I put in my code
> the "require", but always i have a error in the execution.
>
> Source in file "main.lua"
> ...
> require "http"
> ...
>
> -- In terminal using a IDE Goat
> With the LS command I list all files in mmc card and the 2 files found are
> correct, "main.lua" and "http.lua".
>
>     eLua v0.8  Copyright (C) 2007-2011 www.eluaproject.net
>     eLua# ls
>
>     /rom
>     Total on /rom: 0 bytes
>
>
>     /mmc
>     http.lua                       5439 bytes
>     main.lua                       7799 bytes
>     Total on /mmc: 13238 bytes
>
> When I run the file "main.lua" an error occurs and says that the module was
> not found
>
>     eLua# lua /mmc/main.lua
>     Press CTRL+Z to exit Lua
>     lua: /mmc/main.lua:87: module 'http' not found:
>             no field package.preload['http']
>             no file '/mmc/http.lua'
>             no file '/mmc/http.lc'
>             no file '/rom/http.lua'
>             no file '/rom/http.lc'
>     stack traceback:
>             [C]: in function 'require'
>             /mmc/main.lua:87: in main chunk
>             [C]: ?
>
> After the error, if I ask to list the files again nothing is found, as if
> the card was "ejected" by the system, only to reset it back to normal.
>
>     eLua# ls
>
>     /rom
>     Total on /rom: 0 bytes
>     /mmc
>     Total on /mmc: 0 bytes
>
>     eLua#
>
> Someone tell me what might be happening to him can not find the module, what
> can I do to try to solve the problem?

That sounds like an SD card issue. Have you tried a different SD card?
What happens if you do 'cat /mmc/http.lua' ?

Best,
Bogdan

>
> Thanks in advance by the help
> Marcus Vinicius
>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Marcus Vinicius Costa Marcus Vinicius Costa
Reply | Threaded
Open this post in threaded view
|

Re: Problem to import module in eLua - LM3S

Hi Bogdan,

I tested the command 'cat /mmc/http.lua', the system read content of the file normally...

eLua# cat /mmc/http.lua
-- HTTP/1.1 client support over eLua net module
-- Inspired in Lua socket.http
-- Vagner Nascimento
-- July 2010

module("http", package.seeall)

-- support functions
function escape(s)
    return string.gsub(s, "([^A-Za-z0-9_])", function(c)
        return string.format("%%%02x", string.byte(c))
    end)
end

--  local functions
...
    end
end

eLua#

Very strange this...
Have any help for me?

Thanks a lot
Marcus Vinicius

--

Em 11 de abril de 2012 09:45, Marcus Vinicius Costa <[hidden email]> escreveu:
Hi Bogdan, thanks for the prompt response.

I have tested with 2 differents SD cards and i try to send the files direct by terminal and using a PC with windows, but i have the same problem in both...

I will test the command 'cat /mmc/http.lua' to see the result.

Thanks
Marcus Vinicius


2012/4/11 Bogdan Marinescu <[hidden email]>
Hi,

On Wed, Apr 11, 2012 at 3:18 PM, Marcus Vinicius Costa
<[hidden email]> wrote:
> Hi all...
>
> It has to do something different to import modules in eLua, I put in my code
> the "require", but always i have a error in the execution.
>
> Source in file "main.lua"
> ...
> require "http"
> ...
>
> -- In terminal using a IDE Goat
> With the LS command I list all files in mmc card and the 2 files found are
> correct, "main.lua" and "http.lua".
>
>     eLua v0.8  Copyright (C) 2007-2011 www.eluaproject.net
>     eLua# ls
>
>     /rom
>     Total on /rom: 0 bytes
>
>
>     /mmc
>     http.lua                       5439 bytes
>     main.lua                       7799 bytes
>     Total on /mmc: 13238 bytes
>
> When I run the file "main.lua" an error occurs and says that the module was
> not found
>
>     eLua# lua /mmc/main.lua
>     Press CTRL+Z to exit Lua
>     lua: /mmc/main.lua:87: module 'http' not found:
>             no field package.preload['http']
>             no file '/mmc/http.lua'
>             no file '/mmc/http.lc'
>             no file '/rom/http.lua'
>             no file '/rom/http.lc'
>     stack traceback:
>             [C]: in function 'require'
>             /mmc/main.lua:87: in main chunk
>             [C]: ?
>
> After the error, if I ask to list the files again nothing is found, as if
> the card was "ejected" by the system, only to reset it back to normal.
>
>     eLua# ls
>
>     /rom
>     Total on /rom: 0 bytes
>     /mmc
>     Total on /mmc: 0 bytes
>
>     eLua#
>
> Someone tell me what might be happening to him can not find the module, what
> can I do to try to solve the problem?

That sounds like an SD card issue. Have you tried a different SD card?
What happens if you do 'cat /mmc/http.lua' ?

Best,
Bogdan

>
> Thanks in advance by the help
> Marcus Vinicius
>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev



_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Martin Guy Martin Guy
Reply | Threaded
Open this post in threaded view
|

Re: Problem to import module in eLua - LM3S

On 13 April 2012 00:40, Marcus Vinicius Costa <[hidden email]> wrote:
> I tested the command 'cat /mmc/http.lua', the system read content of the
> file normally...

Hi
   I have an application where you "require" a main file and *that*
requires other files that require other files, and it all works OK.
That is on AVR32 platform; if your problem is repeatable it sounds
like a bug in the eLua code. However, since nested requires work on
one platform, that suggests that it is a problem in the SD-driving
code for your board. What processor/board are you using?

    M
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev