WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Lua or ?  (Read 3829 times)

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Lua or ?
« on: February 17, 2015, 11:42:52 PM »
I see Luajit in in the tcz's

Has anyone got Lua going on the Pi?

I want a scripting interpreter that is faster than shell and smaller than python.
Is Lua the only one that fits?

Got some Pi 2 's on the way and I want to try multi threading for robotics/drone stuff.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Lua or ?
« Reply #1 on: February 18, 2015, 02:10:41 AM »
A while ago we tested different languages on RPi. It was a simple test generating prime numbers. Goal was not a generic benchmark but to see arithmetics. The winner was LUAJIT which was a big supprise. It was found that LUAJIT used floating point aritmetics for integer operation where it was faster. C, BACON (the BASIC compiler) and GO were a bit slower but very closed. These four were followd by RUBY,  than PERL and PYTHON which were much slower. So LUAJIT seems to be a good choise.

Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: Lua or ?
« Reply #2 on: February 18, 2015, 02:29:54 AM »
OK, so another language to learn:(

Luajit = Lua Just In Time compiler, so compiled not interpreted.
A bit like Java?

450kB compared to 20MB+ for python.

Wonder if it can talk to the GPIO etc?

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Lua or ?
« Reply #3 on: February 18, 2015, 03:01:31 AM »
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: Lua or ?
« Reply #4 on: February 23, 2015, 02:09:14 AM »
Got new Pi 2, yippee, so fast.

Been using the Pi 2 running latest Raspbian to test Lua and this library.
https://github.com/vsergeev/lua-periphery

Just got Lua GPIO code to turn LED on.
Yep also works with LuaJIT to.

Now the question is how to get the lua-periphery library ported to piCore?

This is day one of Lua coding for me.

piCore base plus LuaJIT plus app code on Pi A+ all in 25MB?
Can you still get 64MB microSD cards:0


Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Lua or ?
« Reply #5 on: February 23, 2015, 02:31:42 AM »

Now the question is how to get the lua-periphery library ported to piCore?


It is just a C code. No need to port, just compile and try. If works, create a TCZ.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: Lua or ?
« Reply #6 on: February 23, 2015, 03:28:04 AM »
Hi,

I don't suppose you want to make a full development version of piCore to run on the Pi 2?
With Lua, python, C compiler and IDE(Geany?) preinstalled for Pi and Pi 2.
Base, SSH, X and DevX++.

Been meaning to learn how to make tcz's .
TC/PiCore will be what I will be using for all my Pi based embedded devices.
This is now on my list of things to do, but it is a long list:)

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Lua or ?
« Reply #7 on: February 23, 2015, 03:52:24 AM »

I don't suppose you want to make a full development version of piCore to run on the Pi 2?


Why?
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: Lua or ?
« Reply #8 on: February 23, 2015, 07:40:02 PM »
Hi Bela,

Most of my development is done off Net behind the University firewalls.
So it is hard to install tcz's, mostly I have to do it manually, which does not work most of the time.
Imagine trying to manually install GCC:(

That's why I mostly use Busybox ash shell scripting now, but it is too slow for some the stuff I need to do.
But it is reliable with 65 and 35 days uptime on two systems so far:)

LuaJIT is a small tcz and does not need large dependencies/libraries like python, apart from that Lua-periphery one.

Pi 2 with piCore  X windows, SSH and Dev tools + SDKs would be fast enough for native development?

Gavin