eluino and constrain function

28 views
Skip to first unread message

Gabriel Duarte

unread,
Mar 7, 2013, 12:52:35 PM3/7/13
to eLua Users and Development List (www.eluaproject.net), miz...@googlegroups.com
Hello people!,

some few days ago, I've started writing an Arduino like interface to eLua, called eluino. Before you start throwing rocks, I got a reason.
Some of my friends use Arduino to build their projects and are not used to program in Lua, then I thought to myself that I could build a set o functions
to help them to start with eLua.

For now, I got a small set of function, not including analog functions:

I have tested in my MBed and Mizar32 and worked fine. After starting mapping, I found the function constrain, from Arduino, but I didn't find it in eLua. I know
it's a easy function to implement, so I decided to put on Lua, adding directly to lmath.c, but I think it's not the right place to put it.
The commit is there:

I hope it will be useful for someone out there... suggestions are welcome!

Cheers,
--
Gabriel Duarte
Linux User #471185
Rio de Janeiro / RJ
http://genericdev.wordpress.com/

Gabriel Duarte

unread,
Mar 7, 2013, 9:07:26 PM3/7/13
to eLua Users and Development List (www.eluaproject.net), miz...@googlegroups.com
No opinions? :p

2013/3/7 Gabriel Duarte <confu...@gmail.com>

martinwguy

unread,
Mar 8, 2013, 1:47:39 AM3/8/13
to miz...@googlegroups.com, eLua Users and Development List (www.eluaproject.net)
Hello Gabriel and good morning. It is 7:30a.m. here.

I think that one of eLua's aims is to be small in code and memory use,
so mainline avoids adding features that are not necessary in the core.

For your project, you could implement that function in Lua, in an
include file (oops, sorry, a "require" file) and in less code.

In general, when people only know one language and then meet a second
one, they usually try to program in the first language using the
second by #defining the second to look like the first, simply because
the first language forms your way of thinking about computer
programming, and provides your first vocabulary for programming
concepts.
I think the classic example is the original Bourne Shell, which was
written in C #defined to look like ALGOL, complete with IF THEN ELSE
ENDIF macros.

It's good as a personal programming exercise to help you understand
the correspondences between the two languages, but if you write real
programs in your new dialect, you isolate yourself from the community
that already speaks the second language.

Not that I like eLua's libraries - I would have implemented luaposix,
luasockets, luafs and their friends, specifically to unite with the
existing community and to be able to use hundreds of standard
libraries, but at least everyone understands what I mean if I use the
eLua constructs...

Welcome to eLua!

M

Gabriel Duarte

unread,
Mar 8, 2013, 8:41:24 AM3/8/13
to miz...@googlegroups.com, eLua Users and Development List (www.eluaproject.net)
Hello Martin, good morning too :)

2013/3/8 martinwguy <marti...@gmail.com>

Hello Gabriel and good morning. It is 7:30a.m. here.

I think that one of eLua's aims is to be small in code and memory use,
so mainline avoids adding features that are not necessary in the core.

For your project, you could implement that function in Lua, in an
include file (oops, sorry, a "require" file) and in less code.

Yes, I agree,  I will talk to Dado today and I we will discuss the better place to distribute it.
 

In general, when people only know one language and then meet a second
one, they usually try to program in the first language using the
second by #defining the second to look like the first, simply because
the first language forms your way of thinking about computer
programming, and provides your first vocabulary for programming
concepts.
I think the classic example is the original Bourne Shell, which was
written in C #defined to look like ALGOL, complete with IF THEN ELSE
ENDIF macros.

It's good as a personal programming exercise to help you understand
the correspondences between the two languages, but if you write real
programs in your new dialect, you isolate yourself from the community
that already speaks the second language.

I do agree too, but note, it's not for me, but for my friends that come from
Arduino world. I know Lua, no problemas, but my friends had some difficult
at first trying to understand Lua's syntax, then I decided to do this.
Is just a try to help them to give the first steps with Lua/eLua.

eluino is just a function wrapper, the rest of the language continues intact,
no macros, no new definitions.
 

Not that I like eLua's libraries - I would have implemented luaposix,
luasockets, luafs and their friends, specifically to unite with the
existing community and to be able to use hundreds of standard
libraries, but at least everyone understands what I mean if I use the
eLua constructs...

Welcome to eLua!

Thank you! :D 

   M

--
You received this message because you are subscribed to the Google Groups "Mizar32" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mizar32+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Lucas R. Martins

unread,
Mar 8, 2013, 10:38:52 AM3/8/13
to eLua Users and Development List (www.eluaproject.net), miz...@googlegroups.com
I think that it's useful to port programs, libs, and most off all, mindsets from Arduino to eLua platforms.
Deserves a nice disclosure!


2013/3/8 Gabriel Duarte <confu...@gmail.com>
_______________________________________________
eLua-dev mailing list
eLua...@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/elua-dev

Reply all
Reply to author
Forward
0 new messages