Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[question] can I build this with Lua 5.1.5? #1

Open
devmanso opened this issue Nov 12, 2020 · 10 comments
Open

[question] can I build this with Lua 5.1.5? #1

devmanso opened this issue Nov 12, 2020 · 10 comments

Comments

@devmanso
Copy link

I think the title explains itself, if I cannot build it with Lua 5.1.5 which version do I build it with

@aprell
Copy link
Owner

aprell commented Nov 12, 2020

I think I've never tested it with Lua 5.1... It should work with 5.2 and 5.3. What problems are you seeing with 5.1.5?

@devmanso
Copy link
Author

sorry for the late response, I had things to do. Anyways I'm on a school Chromebook (laptop broke, its getting repaired) so for now I'm coding on repl.it (online IDE) it supports only Lua 5.1.5 and when I try to build and compile the code it gives me this error:

lua: ./core.lua:8: module 'lpeg' not found:
    no field package.preload['lpeg']
    no file 'src/lpeg.lua'
    no file './lpeg.lua'
    no file '/usr/local/share/lua/5.1/lpeg.lua'
    no file '/usr/local/share/lua/5.1/lpeg/init.lua'
    no file '/usr/local/lib/lua/5.1/lpeg.lua'
    no file '/usr/local/lib/lua/5.1/lpeg/init.lua'
    no file '/usr/share/lua/5.1/lpeg.lua'
    no file '/usr/share/lua/5.1/lpeg/init.lua'
    no file './lpeg.so'
    no file '/usr/local/lib/lua/5.1/lpeg.so'
    no file '/usr/lib/x86_64-linux-gnu/lua/5.1/lpeg.so'
    no file '/usr/lib/lua/5.1/lpeg.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
    [C]: in function 'require'
    ./core.lua:8: in main chunk
    [C]: in function 'require'
    [string "<eval>"]:3: in main chunk

perhaps I did something wrong when I was building it or perhaps[ps I cannot build it with that version of Lua.

here is what my build looks like: https://repl.it/@Planebagel/tiny#main.lua

@aprell
Copy link
Owner

aprell commented Nov 13, 2020

I'm not sure if it works there because you need LPeg. On your machine, you could install LuaRocks (a package manager for Lua) and get LPeg with luarocks install lpeg.

@devmanso
Copy link
Author

is there any other way to get LPeg? Unfortunately you can't use LuaRocks with repl.it

@aprell
Copy link
Owner

aprell commented Nov 14, 2020

Not easily, I guess... You could check if LuLPeg works on repl.it, and if it does, try to use it as a replacement for LPeg. But no guarantee that you won't run into other issues.

@devmanso
Copy link
Author

I think I actually found out a way to install Luarocks and lpeg on repl.it using bash/shell commands:

get https://luarocks.org/releases/luarocks-3.3.1.tar.gz
tar zxpf luarocks-3.3.1.tar.gz
cd luarocks-3.3.1
./configure && make && sudo make install
sudo luarocks install luasocket
sudo luarocks install lpeg
lua src/main.lua 

however I get a different error:

lua: ./test.lua:31: ambiguous syntax (function call x new statement) near '('
Makefile:2: recipe for target 'test' failed
make: *** [test] Error 1

here is my build: https://repl.it/@Planebagel/tinylua#main.sh

@aprell
Copy link
Owner

aprell commented Nov 16, 2020

Interesting, I didn't know about that parsing issue. Looking into it...

@aprell
Copy link
Owner

aprell commented Nov 16, 2020

The TEST calls confused the parser. The rest of the code should be fine.

@devmanso
Copy link
Author

I builded it again and the test.lua errors are gone.... kinda. When i try to run the build I get a different error:

./test.lua: 3: ./test.lua: package.path: not found
./test.lua: 5: local: not in a function
Makefile:2: recipe for target 'test' failed
make: *** [test] Error 2
exit status 2

the bash/shell commands are exactly the same:

get https://luarocks.org/releases/luarocks-3.3.1.tar.gz
tar zxpf luarocks-3.3.1.tar.gz
cd luarocks-3.3.1
./configure && make && sudo make install
sudo luarocks install luasocket
sudo luarocks install lpeg
lua src/main.lua 

If you'd like to see my build on repl.it : https://repl.it/@Planebagel/tinylua#test/test.lua

@aprell
Copy link
Owner

aprell commented Nov 18, 2020

I don't think this shell script works as intended... When I click on "Run", all that runs is make, and make reads in tiny's Makefile, which tries to run the tests.

These errors are unrelated to Lua. I saw that you removed the first line in test/test.lua. You can do that, but you need to replace ./test.lua with lua test.lua in the Makefile.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants