MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

icon
Avatar
ismailsurek37
Posts: 7
hi
How can possible is the using Lua script with mobiflight .
Lua ; seem on configurator when building up the sooftware
can anyone describe how to use can using Lua because if possible,
Using 74HC4067 multiplexer can use for input so we will have more ports
we were used Lua inputs( button switch and comutator ) for FWD and AFT overhead with 2 arduino mega
but need to working hard to use this for outputs
Thanks
2019-12-14 18:24
Avatar
ismailsurek37
Posts: 7
how can we use this code_ ?
https://bitbucket.org/mobiflight/mobiflightfc/src/master/MobiFlight/InputConfig/LuaMacroInputAction.cs
--------------------------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MobiFlight.FSUIPC;

namespace MobiFlight.InputConfig
{
class LuaMacroInputAction : InputAction
{
public String MacroName = "";
public Int32 MacroValue = 0;
public new const String Label = "Lua Macro";
public const String TYPE = "LuaMacroInputAction";

public override object Clone()
{
LuaMacroInputAction clone = new LuaMacroInputAction();
clone.MacroName = MacroName;

return clone;
}

public override void ReadXml(System.Xml.XmlReader reader)
{

MacroName = reader["macroName"];
MacroValue = Int32.Parse(reader["value"]);
}

public override void WriteXml(System.Xml.XmlWriter writer)
{
writer.WriteAttributeString("type", TYPE);
writer.WriteAttributeString("macroName", MacroName);
writer.WriteAttributeString("value", MacroValue.ToString());
}

public override void execute(FSUIPC.FSUIPCCacheInterface cache, MobiFlightCacheInterface moduleCache)
{
if (MacroName == "") return;

Log.Instance.log("LuaMacoInputAction:Execute : Calling macro " + MacroName, LogSeverity.Debug);
cache.executeMacro(MacroName, MacroValue);
}
}
}
2019-12-14 20:26
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 2911
Supporter
Check this short posting for syntax notes.

https://www.mobiflight.com/forum/message/10232.html

Apology for missing guide..... In case no "beginners" need this stuff and the pro users still know themself how to work with it there was no needness until now for a guide.
I personlaly not use it myself till now so i not start to write a guide and i also not have won experience with it.
Good Luck !
2019-12-17 03:51
icon