lua-users home
lua-l archive

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


Well,

On Aug 31, 2010, at 2:18 PM, Patrick McCavery wrote:

> 
>> using luasockt does not change the fact that luasocket is written in C.
> 
>> My answer is the same:
>> 1. things cannot be written in Lua.
>> 2. things are easier to write in C.
>> 
>> for example:
>> 
>> You've got a C++ game as the host program of lua, and you want to move
>> the player character from axis (1,1) to (999,999), without providing
>> the C++ function in Lua, you cannot do this at all.
>> 
>> You're the author of awesome window manager,
>> a window manager is undoubtly an application, and it provides features
>> such as window decorations and window movement, maximize, minimize,
>> size, zoom. and it also captures keyboard/mouse input in order to
>> provide shoutcuts. See http://awesome.naquadah.org/doc/api/ to check
>> what he had done, all those are written in C, because those has to
>> written in C in order that Lua can access those features.
>> 
>> You're a developer of a MID device, you want to access certain
>> features such as WiFi signal check, Bluetooth switch, LED screen
>> brightness, you will have to write those in C.
>> 
>> 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.
>> 
>> 
> 
> This is the answer I was looking for when I started the thread, thank you so much-Patrick

Well, one can do all the listed in pure Lua, using the WIFI signal, RFKILL and LED stuff under Linux and friends by simple writing to /proc and /sys files as C code would do, and the remaining with FFI and friends.

Writing one can not do everything in Lua is as writing one can not do anything in GCJ (Java), Fortran, D, Go, or whatever just because a variety standard libs happen to be written in insecure C.

Then you can not even do *everything* in C, and sometime *have* to dive into assembly, ...

Greetings,

-- 
  René Rebe, ExactCODE GmbH, Jaegerstr. 67, DE-10117 Berlin
  http://exactcode.com | http://t2-project.org | http://rene.rebe.de