Building LuaSec/LuaCrypto/OpenSSL for Lua on Windows

OpenSSL and LuaSec/LuaCrypto are pretty common libraries within the Lua eco system. Where other cornerstone libraries are on their own (LuaSocket and LuaFileSystem/lfs), the issue with LuaSec/LuaCrypto is that they are bindings to OpenSSL, which requires a properly compiled OpenSSL version. (“properly compiled” is related to the runtime libraries used, they need to be compiled against the same versions, so just grabbing the OpenSSL dll files from some other project might deliver unexpected results/failures/crashes) Continue reading

Lua; configuring path settings

A common problem with Lua newbies is the setup of the Lua environment. As many other programming/scripting languages Lua allows you to load external libraries. To prevent you from having to type exact system paths, Lua uses so called library paths to automatically look them up.

For this purpose Lua has 2 environment variables, LUA_PATH and LUA_CPATH. The former is used for loading Lua libraries, the latter for C libraries. Despite the different targets, they both work the same. And if you are familiar with the regular system PATH variables, then you already know the concept. Continue reading

Setting up a basic Lua installation on Windows

There is an updated version of this post here

The older LuaforWindows distribution is getting obsolete quickly these days. Also because the distribution is aging, many “batteries” are out dated and they are not easily replaced as the package managers do not integrate with it. So I started an endavour to update my windows system with a clean installation (minimal batteries) and a proper package manager to be able to update and extend packages as needed.

Continue reading

UPnP gateway; first working sample

The UPnP gateway now gets to a point that might even justify a pre-release, finally! It can be started from a batch file and configured to run one or more drivers. Capable of publishing dozens of UPnP devices simultaneously (be it as sub-devices)

A driver template is included so new drivers can quickly be setup. A fully functional xplrfx driver is included as well as 3 demo drivers. All c code is now compiled for distribution, no more development/debug libraries required. Continue reading

Lua; states, threads, libraries and memory layout

For a couple of years now I’ve been programming a lot in Lua. One of the things I had a hard time with was the relation between the states, threads (coroutines in Lua) and memory layout.  This is mostly simple when doing some basic scripting, but once you start writing C libraries or library bindings you really need to be aware of all the nitty gritty details. Now throw in some multi-threading and you’ll get yourself in trouble in no time, if you’re not careful.
Continue reading

HackersNL talk on home automation and Lua

So yesterday, I gave a talk on home automation at HackersNL in Utrecht, nice and friendly audience and plenty of new ideas.

I’ve uploaded the slideset, available here (downloaded 1269 times). Furthermore some additional comments and links;

  • Home automation site; check out bwired.nl, awesome. Nothing to add to that.
  • Bwired also has a generic home automation forum, not specifically related to a server product.
  • xPL and all its related info can be found on the xPL project site
  • For the internet-of-things there is a great open source project started by Sierra-Wireless. It is being run under the Eclipse umbrella and already delivered some nice results. Check out Koneki (LDT and OMA), Mihini and Paho.

UPnP forum logo
For a start with UPnP there is a lot of documentation on the forum pages. But there is no real shortcut to UPnP, but here’s where to start

  • To get a feel of what it can do, download the UPnP Developer Tools (runs on .NET, so might also work on Mono, but never tried). Use the DeviceSpy utility to examine some of your own devices and fiddle with the actions (Tip: right-click on a service and subscribe to events). Also give the included “Network Light” sample application a try (to fiddle with from Device Spy).
  • Read the UPnP Device Architecture 1.1 document (UDA), even if you don’t make it through, focus on sections;
    • 1 Discovery (introduction only)
    • 2 Description (introduction only)
    • 2.3 Device Description
    • 2.5 Service Description
    • 3 Control (introduction only)
    • 4 Eventing (introduction only)
  • Browse the device and service specifications. Start with “Lighting Controls_1” which are fairly easy to read, and once you get the concept of those try something more challenging like the Media Server/Renderer stuff.

It was a fun evening, thanks for the invitation guys! If you have any questions or want some more info, just drop a message below.

 

 

Setting up Lua Development Tools with Koneki, for local development

Recently, while looking for a better Lua IDE I tried the Lua Development Tools by the Koneki project. The Koneki project focusses on machine-2-machine (M2M) development and hence does not yet support local run and debug configurations. With a support link to some helpful pages (which didn’t work straight away), I fiddled around a bit and got it working through the ‘external tools’ workaround, though still with some quirks. Also not sure it all works as it should, especially adding command line parameters is something I’ll be needing to fix still. Continue reading