Part 3: Take advantage of extensibility (10%)
We have done a bunch of work to move functionality from C to Lua, only to end up with the “same” program. Now comes the payoff!
Your task: Modify lscript.lua
to do something fun / interesting, instead of simply
forwarding/logging input and output verbatim. Take advantage of the fact that your Lua
code can first see everything the user types, before writing the results (or something
else!) to the screen and the logfile.
Possible modifications include:
- Simulating an old-style modem by storing I/O events and using
periodic
to perform them more slowly. - Writing a translator that transforms the user’s input in some way.
- Writing a tool that records/replays a session (using timing information).
Some important notes:
- You can have fun having your friends (possibly unwittingly)
try your
lscript
tool, but you may not do anything to capture passwords from unsuspecting users. We’ll consider that a violation of the honor code, even if you can claim “No harm was done”, or “I didn’t realize!”. If necessary, stop and think about how a session with a friend might play out before they sit down and start typing. If something goes awry and you capture sensitive information, you must self report (as always). - Similarly, remember that you are working on a shared machine alongside many other users in the CS
department. Your
lscript
tool should abide by the rules-of-use and not attempt to access files that you do not have permission to access nor misuse system resources. - This tutorial on string-matching might be useful, when trying to generate ideas or translate your ideas into Lua!
- You may add additional helper functions in C if you really need them, but Lua already has quite extensive libraries, so there is a good chance that whatever you need is already there.
- This is your chance to be creative. Something fairly trivial (e.g., requiring less than a dozen lines of Lua code) will easily get half credit. You can check with us if you want to know if something is too trivial.