I've recently added NLUA support to my application, with the goal of allowing easy editing of functionality. Perhaps a quick explanation.
I'm making a simple game, in the style of DarkSigns and other "hacking" simulators. I wanted to allow for scripting to be used for both myself and my players. I decided to use NLUA to provide this. The base application is written in c# using WPF and caliburn.micro.
SO i have a simulated console which is actually a textbox for input and a listview for the console ouput, I have a command structure that allows for commands to be typed in and run, including the "connect" command to access a (ingame) IP address, this includes a port which is tied to a script. So connecting to 1.2.3.4 port 25 will run the "port25.lua" script.
All that works fine, however i realized that i have no way to direct input into these scripts, any LUA that calls io.read()
won't actually wait for input and so fails.
So i'm looking at how to solve this, unfortunalty NLUA documentation seems to be pretty thin on the ground, I'm aware this is made more complex by the fact I'm not using an actual console and just simulating one.
Would what i want even be possible? If so how could I redirect NLUA io.read()
to my textbox (if possible) or is there another solution?
Or would moving away from NLUA into another scripting addition be a better solution?
Thanks for your time.