Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI-Nspire => Topic started by: njaddison on January 03, 2012, 06:52:59 pm

Title: It is possible to convert lua to c, and vice versa!
Post by: njaddison on January 03, 2012, 06:52:59 pm
I was surfing the internet, and I found a lua to c converter, and a c to lua converter. It would be possible to convert standard lua scripts to c, so we can run them with ndless, but we would need to create a c to lua converter. This would be awesome because we would be able to play c games without ndless because of the nspire's 3.x lua capabilities.
-Nelson
(http://userbars.removedfromgame.com/ub/3rik383.png) (http://ourl.ca/14475.new#new)
Title: Re: It is possible to convert lua to c, and vice versa!
Post by: epic7 on January 03, 2012, 06:56:03 pm
Wouldn't it be slower in lua if C was converted?
Title: Re: It is possible to convert lua to c, and vice versa!
Post by: njaddison on January 03, 2012, 07:00:53 pm
Well, yeah. But it would originally be c, and I can be patient when using a lua script that was originally c.

(http://userbars.removedfromgame.com/ub/3rik383.png) (http://ourl.ca/14475.new#new)
Title: Re: It is possible to convert lua to c, and vice versa!
Post by: cyanophycean314 on January 03, 2012, 07:38:27 pm
I think C being converted to Lua would have many problems. Speed would probably be an issue, but there are so many features that Lua could not support. I'm not too familiar with either C or Lua, but it seems this wouldn't work.

Secondly, njaddison. You should put that userbar into your signature. That way it's attached to every post, so you don't need to copy and paste it every post.
Title: Re: It is possible to convert lua to c, and vice versa!
Post by: jwalker on January 03, 2012, 07:47:26 pm
you could probably run a lua script indirectly through ndless any way scince there is a lua interpreter, of course i could be wrong
Title: Re: It is possible to convert lua to c, and vice versa!
Post by: TIfanx1999 on January 03, 2012, 10:05:03 pm
It also depends. Although the converter may work, it is a matter of how efficient the code it produces is. Also, what may be good design in one language may not be good coding practice in the other, thus producing overly bloated code. Just some things to keep in mind. :)
Title: Re: It is possible to convert lua to c, and vice versa!
Post by: Nick on January 04, 2012, 01:31:51 pm
i'm afraid it won't work.. switching between languages is already hard to do manually, than how are you supposed to do it automatically?

it won't work by just replacing all the commands, you really need to dig into the syntax and structure to make it useable, and how're you supposed to do that?
Title: Re: It is possible to convert lua to c, and vice versa!
Post by: Jim Bauwens on January 04, 2012, 03:09:14 pm
Converting lua to C is pretty easy as Lua is programmed to be easily intergrated with C.
Converting C to Lua however is a much bigger task, because:
1. It has many different types of variables which are not available in Lua.
2. Most programs access specific stuff (screen, timers, etc) which you can not do from Lua.
3. If you can bypass these limitations, speed would be a very big issue. My logo interpreter just runs at ok speeds, but C is a billion times more complex.

So in short : C to Lua is not possible.
Of course, you can convert some programs manually, but thats another case :P