Lua-RPC

I’ve been contributing to the eLua project since early this year, and have really enjoyed digging into some low-level details for implementing drivers and higher level functionality for an embedded dynamic language.  While many people would toss out the possibility of running a full distribution of a dynamic language (especially one typically used on desktops) on a microcontroller, Lua fits quite well.  You won’t be writing any extensive applications in an environment like this, but many small and medium-sized projects should fit pretty well within the resource limitations imposed by these devices, even with the overhead of a dynamic language.One thing that I’ve started working on recently is a resurrection of Lua-RPC, which is a simple client-server RPC library for Lua.  In general it seems to provide two main services:

  1. Calling remotely defined functions, and serializing the input and output values of these functions.
  2. Calling remote functions in a protected environment that allows errors to be returned to the client that made the call in the first place.

With a set of minor adjustments in place to account for changes between the Lua 4.x and 5.1.x API, it now seems to work fairly well as a module in a current version of Lua, handling remote procedure calls over sockets.  It also now works as a loadable module, so one can use it within scripts or at the Lua REPL.Now that a basic port has been made, the next step I’m working on is getting it up and running over not just sockets but other link types, like serial.  The concept of socket use is pretty well embedded in the design of Lua-RPC, but there’s enough abstraction that it isn’t necessary to rewrite much of the Lua-facing side of the code (those C functions that are registered with Lua), mostly what is needed is establishment of some sort of common interface that will work for not just socket communications, but much less feature-laden link types like RS-232.  I think I have a general path laid out for this, and will likely make some comments as this process goes along.For those interested in the code, you can check out the GitHub project here (no guarantees about any particular commit working well until a release is made, which will be after the link-layer abstraction is working).

Advertisements
Tagged with: ,
Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: