Jump to content
The simFlight Network Forums

Recommended Posts

Posted
Did any of you manage to use LuaSocket in a FSUIPC Lua script ?

LuaSocket? I don't think that is part of any of the Lua libraries I've included in the FSUIPC implementation. Are you somehow adding it via external access?

But a require("socket"), that otherwise works fine (in regular Lua programs), crashes FS when invoked.

"Require" tries to load a module, right? I've not done any testing with external Lua modules. What do they look like? What isd this 2sockets" module -- a DLL or what?

Sorry, this is any area as yet unexplored in my FSUIPC implementation. Maybe it is something I can improve. Have you managed to get any external Lua modules loaded at all?

Regards

Pete

  • 4 weeks later...
Posted

Did any of you manage to use LuaSocket in a FSUIPC Lua script ?

I would like to have a socket serving a HTTP with some FS data, pretty much like MyFSGoogle Earth does (http://www.elbiah.de/flusi/MyFsGoogleEaeEarth.htm)

But a require("socket"), that otherwise works fine (in regular Lua programs), crashes FS when invoked.

Hi Manuel,

Sorry about the delay, but it took me longer than I thought.

The problem with LuaSockets in FS was that the precompiled parts, the socket and mime core DLLs, contained actions which conflicted with things in FS.

However, I am about to release updates of FSUIPC3 and FSUIPC4 with LuaSockets support included. These are the changes:

1. The "print" function in Lua now acts like the ipc.log function, and using the io library for writing to the "stdout" and "stderr" devices also writes the results to the log. This enables ready-made Lua programs which do produce their results with those functions to be used without modification.

2. Lua library modules called for by Require are now looked for in the FS modules folder, but also, and preferably, in a subfolder modules\lua. This enables Lua programs not meant to be run direct from FSUIPC to be kept separate, and also allows code DLLs to be used on FS9 without crashing FS when it tries to load them as modules of itself.

3. Full support has been added for the LuaSockets package (see http://www.tecgraf.puc-rio.br/~diego/prluasocket/ ). In fact it is made a lot easier than the package suggests, as these main modules are built in as "preloaded modules" (still needing "Require", but not files):

The two C/C++ core modules: socket.core and mime.core

The three main Lua modules: socket.lua, mime.lua and ltn12.lua

There are a load of little utility Lua programs provided in the LuaSockets package too, but I've not built those in. They are best placed, if required, into a Lua folder, within the FS Modules folder.

I will include versions of the "testclnt" and "testsvr" Lua plug-ins, which are acceptance tests for the validity of the implementation, and also two plug-ins "MasterClient" and "SlaveServer" which can link two copies of FS with one slaved to the other as far as user aircraft position and attitude is concerned. It runs quite nicely even in the crude unoptimised Lua code I've used in the examples.

I hope to release the updates tomorrow or Friday (25th October).

Regards

Pete

  • 11 months later...
Posted

Hello Peter,

This is probably the longest delay you've got in a follow-up message or reply, he he. I am sorry for that, I was not able to do what I like the most (FS) for some months and I'm recovering from the ashes now.

I'm very glad to know FSUIPC now supports sockets! and using the LuaSocket API. Can't wait to dig some more but the doc is not very clear to me, at least not yet (maybe because I'm not a native english-spoken guy), although I have a good experience with Lua and LuaSocket.

After all these months, I can't imagine what other features you've added to FSUIPC.

Tkanks for the great work.

Manuel

Posted

I'm very glad to know FSUIPC now supports sockets! and using the LuaSocket API. Can't wait to dig some more but the doc is not very clear to me, at least not yet (maybe because I'm not a native english-spoken guy), although I have a good experience with Lua and LuaSocket.

What "doc"? I only added the standard Lua sockets library to FSUIPC, I didn't document it. To be honest I know little about it -- I tested it using samples supplied by the folks who did the library, downloaded from the Lua sites.

After all these months, I can't imagine what other features you've added to FSUIPC.

You don't need to imagine! ;-) Up to the last major releases (3.98 and 4.60) the changes are documented in the History document, installed in your FS Modules\FSUIPC Documents folder, and changes since then are listed along with the Updates in the Updates and other Goodies Announcement in this Forum.

Regards

Pete

  • 4 weeks later...
Posted

What "doc"? I only added the standard Lua sockets library to FSUIPC, I didn't document it. To be honest I know little about it -- I tested it using samples supplied by the folks who did the library, downloaded from the Lua sites.

Could you please tell me where the luasockets in FSUIPC doc is ? Please forgive me if I missed it somehow. I know you hate to point obvious things to your customers :) but I could not find it in the "regular" doc, as well as any other Lua-related doc neither. The only Lua doc I have is what you had on your release announcement.

I hope this will help and encourage some other people to work with Lua too.

Thanks for this.

Regards

Posted
Could you please tell me where the luasockets in FSUIPC doc is ? Please forgive me if I missed it somehow. I know you hate to point obvious things to your customers smile.gif but I could not find it in the "regular" doc, as well as any other Lua-related doc neither. The only Lua doc I have is what you had on your release announcement.

:-(

Download FSUIPC, then run the Installer. It installs FSUIPC and all of the documentation -- you will see an "FSUIPC documents" folder inside the Modules folder.

It does tell you this in the brief instructions inside the FSUIPC ZIP file which you should follow to install and register FSUIPC!

Pete

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.