lua text interface library (i.e., writing a custom shell in lua)

Specifically, something which automates the drudgery along the lines of Perl's Term::Shell

Failing that, are there any good parsing libraries which would suit such a project?

I have a need to wrap an OEM-provided tool -- which, while usable, is utterly baroque -- in something a little friendlier to the human brain.

Thanks to all who reply!

-------------Problems Reply------------

Well, depending of your lua implementation, but the os.execute() function allow to call a shell function on your system (i do not know though if it will work since you are working on embedded device), but a custom shell is easy to write in Lua from scratch.

Just get the user input using io.read() / io.write() functions, then you can parse the user commande using such function :

function string.split(self,c)
local l , c , b = {} , c or " " , self
while b:find(c) do
table.insert(l,b:sub(0,({b:find(c)})[1]-1))
b = b:sub(({b:find(c)})[1]+(#c))
end
if not(b == "") then table.insert(l,b) end
return l
end

The command name is given by the first token of the table, and all the arguments are following, dealing with table functions and unpack() parsing will be very fast to implement.

If your OEM has a C interface, consider writing a binary module instead. That way you will be able to use the default lua console:

$: lua

Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> oem = require 'baroque-oem'
> oem.foo('bar')

Category:lua Views:3 Time:2012-02-17

Related post

  • C++ generic realtime text interface library 2011-04-26

    Silly question here, I'm looking for a generic text based API for command-line programs. Something like ncurses I think would fit the bill. In an ideal world, I would like something portable, between windows and linux, but for now, it'll only be runn

  • Is It Possible To Setup An Interface Library For A DAL Using Entity Framework? 2009-09-15

    I have a model library (namespace Test.App.Model.EF) with the Entity Framework implementation in it. This has all of the entities provided in the EF designer for me which I want to use. Within this Model.EF implementation, I have several repository c

  • High Quality text rendering library for OpenGL 2010-11-01

    I am looking for a high-quality text rendering library for OpenGL, Can you help ? --------------Solutions------------- What are your requirements - light vs. heavy? what OSes? will you be needing Asian characters? right-to-left? What programming lang

  • Best / most complete jQuery user interface library? 2010-12-22

    We're looking for the best jQuery-based user interface library we can find. It doesn't have to be free. What are people using? We've used jQueryUI, but development seems to have stalled. Not much new there in a long time. jQuery Tools looks slick and

  • Pure Java text interface for a roguelike game 2011-02-02

    OK, this is going to sound like a crazy idea - but I'm interested in emulating a 1980s style roguelike game text interface in pure Java, i.e. using Swing or similar. Here's roughly what it needs to do: Provide a fixed size grid of fixed size characte

  • PHP library for reading/writing MS Excel files? 2011-02-04

    Is there a free PHP library for reading/writing excel files? I don't want to use XML (I think you could read excel files as XML, I don't want to do it that way). I also need to create graphs and other goodies, so saving the file as csv will not work

  • Any suggestions for an interactive text command library? 2011-04-05

    Can anyone suggest an open source library that supports a user interactive text input system? I'm looking for something that can help me create a text GUI widget similar to Python's IDLE and Matlab's interactive text widgets. I'd prefer this library

  • Writing a wireshark dissector in lua and setting it on a dynamic port 2011-05-13

    I have a client server protocol that works the following way. Client sends udp broadcast with servers id (to a fixed port). Server receives the datagram and if its matches his id he sends the client the port that he is listening to. Then the client o

  • Full text search library for multilingual content 2011-07-19

    What is a good full-text search library (free/licensed) that works well with multilingual data? --------------Solutions------------- Lucene has analyzers for a wide variety of languages. That only works, of course, if you know which language each doc

  • How to escape characters in Haskell's Text.Regex library? 2011-10-11

    Introduction I'm using Haskell's Text.Regex library and I want to match some characters that normally have meaning in regular expressions. According to Text.Regex's documentation, The syntax of regular expressions is ... that of egrep (i.e. POSIX "ex

  • Simple Text Analysis library for C 2012-02-23

    I'm in the midst of creating my school project for our programming class. I'm making a Medical Care system console app and I want to implement this kind of feature: When a user enters what they are feeling. (Like they are feeling sick, having sore th

  • Columnar browsing interface library for hierarchical data using jQuery? 2012-03-20

    I need to implement a hierarchical data browser in my Rails (3.2.1) application. Looking for a some user interface library which resembles Mac OS X Finder's column view or columnar class browser. First question is, how people call this kind of interf

  • Text indexing library in C/C++ 2012-03-21

    I am developing a Windows desktop product which requires text indexing library in C/C++. I would want to give it series of words and a record that needs to be stored against those words. Searching those words should bring back one or more records qui

  • Reading and writing C struct from embedded lua 2010-09-13

    I'd like to embed lua to allow scripting in my C++ application. In particular, I have two structs which I'd like to pass as arguments to a given lua function. One will be read-only, the other will be read/write. Highly simplified examples of these st

  • Is implementing ISerializable interface necessary when not implementing any custom serialization/deserialization 2012-01-19

    I am looking at a class in a solution that implements the ISerializable interface. It has a GetObjectData method for serialization as required by the interface. There is not any custom serialization happening here, it is simply populating the Seriali

  • Writing a Windows Shell Extension similiar to the Assembly Cache Viewer 2009-09-11

    I would like to write a shell extensions to completely customize the display of a particular folder, ala the Assembly Cache Viewer (browse to c:\windows\assembly and you will see what I mean). Which COM interfaces are responsible for providing these

  • Writing a custom iterator - what to do if you're at the end of the array? 2010-04-24

    I'm writing a custom iterator for a Matrix class, and I want to implement the increment method, which gets called when the iterator is incremented: void MatrixIterator::increment() { // go to the next element } Suppose the iterator has been increment

  • Writing a custom Flume decorator, but getting errors. What am I missing? 2010-10-19

    I'm writing a custom decorator plugin for Cloudera's distributed log aggregation system, Flume. My Java code is below: package multiplex; import java.io.IOException; import java.util.ArrayList; import java.util.List; import com.cloudera.flume.conf.Co

  • CakePHP Architectural Question - Writing a custom search for model 2011-02-24

    I started using CakePHP 3 days ago and I'm in middle of a spike solution right now. I'm learning it pretty quickly, but some of the functionality isn't clear in my head yet. I was looking for some advice on how to proceed next. I'm writing a search,

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.158 (s). 12 q(s)