Updated version here.
There are a few reasons why I'm putting this here instead of the Unofficial Addons section, for now, which will become clear shortly. Granted this is technically breaking the "rules", so mods feel free to move it.
However, I present luaLFS. luaLFS was the by-product of another project I was working on a number of months ago. Basically it's an InSim client, which does the "heavy" network lifting and then fires off events to a set of LUA scripts.
I've cleaned it up a little bit and decided that a few other coders might be interested. Despite this, it's still very hacky and was put together in an evening - hence lots of hardcoded values, and so on. Over the next few months I fully intend to clean it up properly, put together a nice set high level API functions for use in the Lua scripts, make a nice Lua based configuration and then release it for the masses.
However, I thought that perhaps a few other members might be interested and might even want to run with the project, so I've licenced it under the Apache2 licence, zipped up the source with a binary version.
Currently the process is as follows:
This implementation is in C, which I know some people won't care for. It's what I love though.
Bundled in this inital toy version are a few examples of how luaLFS will work in the future.
I will stress again that I am releasing this as a proof of concept and the current code is very hacky. I make no guarantees that it won't crash, nor of any release timescales. If anyone wants to submit patches, feel free.
Updated version here.
There are a few reasons why I'm putting this here instead of the Unofficial Addons section, for now, which will become clear shortly. Granted this is technically breaking the "rules", so mods feel free to move it.
However, I present luaLFS. luaLFS was the by-product of another project I was working on a number of months ago. Basically it's an InSim client, which does the "heavy" network lifting and then fires off events to a set of LUA scripts.
I've cleaned it up a little bit and decided that a few other coders might be interested. Despite this, it's still very hacky and was put together in an evening - hence lots of hardcoded values, and so on. Over the next few months I fully intend to clean it up properly, put together a nice set high level API functions for use in the Lua scripts, make a nice Lua based configuration and then release it for the masses.
However, I thought that perhaps a few other members might be interested and might even want to run with the project, so I've licenced it under the Apache2 licence, zipped up the source with a binary version.
Currently the process is as follows:
- luaLFS creates a Lua environment
- luaLFS loads the core scripts (./scripts/core/core.lua), and then loads all other files with the substring "lua" in them, from the ./scripts directory. These files are parsed
- luaLFS creates an InSim connection
- luaLFS monitors the connection, keeping it alive, and watches for timeouts. For all packets, other than VER packets, they are fired off into the core Lua scripts.
- The core scripts implement a very, very, very simple event system and call functions associated with a set of events. Currently there is a couple of custom events, such as start up, shutdown, etc. The rest of the packets are passed, as they come from LFS directly to the bound functions for that packet type.
- When LFS closes luaLFS attempts to stay around for 2 minutes before timing out.
- On timeout disconnection event is fired, then shutdown and the lua environment is shutdown
- Program exits
- Very hacky, lots of stuff that needs cleaning up
- LFS needs to be running and listening for an InSim connection first. It will not attempt to reconnect.
- LFS needs to have no admin password set
- Lua garbage collection needs to be called explicitly once every few minutes on a very busy connection. This doesn't get taken care of automatically at the moment. Simple to add though
- No real configuration, requires port 29999 to be used on LFS and uses 29998 as the listening port. Will be fixed when I refactor a Lua based configuration snippet from another project
- No API. As the packets are passed as binary strings, unless they are unpacked, and then functions bound, its reasonably complex to get your head around. I do plan on creating a simple to use API
- It should be cross platform capable because I've chosen Lua and all the network code is using the berkely functions, and the WIN32 stuff is conditionally invoked
- It's cool and easily extensible, once the API is written
This implementation is in C, which I know some people won't care for. It's what I love though.
Bundled in this inital toy version are a few examples of how luaLFS will work in the future.
I will stress again that I am releasing this as a proof of concept and the current code is very hacky. I make no guarantees that it won't crash, nor of any release timescales. If anyone wants to submit patches, feel free.
Updated version here.