lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Aug 31, 2010, at 9:52 AM, Pan Shi Zhu wrote:

On Tue, Aug 31, 2010 at 2:33 PM, steve donovan
<steve.j.donovan@gmail.com> wrote:
On Tue, Aug 31, 2010 at 2:29 AM, Pan Shi Zhu <pan.shizhu@gmail.com> wrote:
For example, if you have a vanilla lua without any modules, how can
you do socket communication without writing any C code? how can you
play music without any C code?

True, but that is why there are semi-standard external libraries like
LuaSocket and LuaFileSystem.

using luasockt does not change the fact that luasocket is written in C.


Alien provides a FFI and there are some impressive examples of Lua
speaking to libraries just using that bridge.

calling a FFI library also does not change the fact that the library
may written in C (or other compiling languages)


The question is more, how can you justify _application_ code in C?

My answer is the same:
1. things cannot be written in Lua.
2. things are easier to write in C.

for example:

...

If that is a bit hardware-related, just think: you want to "minimize
every applications and show the desktop." Can you do that in Lua?

There's so many things cannot be done in Lua, so we must write those
in C, and provide functions in Lua.

For one Lua is turing completely, so anything can be done.

For another one can use FFI and friends and construct legacy ISA level calls on-the-fly.

Cheers,

-- 
  René Rebe, ExactCODE GmbH, Jaegerstr. 67, DE-10117 Berlin