Python to Lua & Python to Lua to Python always return Nil
Python:
if cmd == "f":
lua = Fougerite.GlobalPluginCollector.GetPlugin(Fougerite.GlobalPluginCollector.GetPluginCollector(), "LuaTest")
result = lua.Invoke("TestFunction", Player.SteamID)
Util.Log(result)
Code:
function TestFunction(SteamID)
donatorrank = Fougerite.GlobalPluginCollector.GetPlugin(Fougerite.GlobalPluginCollector.GetPluginCollector(), "DonatorRank")
rank = donatorrank.Invoke("CheckPerm", SteamID, "Rank")
return rank
end
Error:
Code:
[6/21/2016 10:55:11 PM] [Error] [MoonSharp] Error in plugin LuaTest:
[6/21/2016 10:55:11 PM] [Error] [MoonSharp] Invoke failed: MoonSharp.Interpreter.ScriptRuntimeException: attempt to index a nil value
at MoonSharp.Interpreter.Execution.VM.Processor.ExecIndex (MoonSharp.Interpreter.Execution.VM.Instruction i, Int32 instructionPtr) [0x00000] in <filename unknown>:0
at MoonSharp.Interpreter.Execution.VM.Processor.Processing_Loop (Int32 instructionPtr) [0x00000] in <filename unknown>:0
BUT
Doing Python to Lua and in the lua function Util.Log("Blah Blah") will work, Just seems it doesn't want to return any values (Above error).
Magma's invoke is internal use only.
Haven't tried C#
------------------------------------------------------------------------------------------------------------------------
EDIT:
trying to do C#, It will not compile
Code:
Severity Code Description Project File Line Suppression State
Error CS1501 No overload for method 'GetPlugin' takes 2 arguments CTestPlugin C:\Users\****\Desktop\CTestPlugin\CTestPlugin\Class1.cs 51 Active
Severity Code Description Project File Line Suppression State
Error CS1061 'object' does not contain a definition for 'Invoke' and no extension method 'Invoke' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) CTestPlugin C:\Users\****\Desktop\CTestPlugin\CTestPlugin\Class1.cs 52 Active
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Fougerite;
using IronPythonModule;
using MagmaModule;
namespace CTestPlugin
{
public class CTestPlugin : Fougerite.Module
{
public override string Name
{
get
{
return "CTestPlugin";
}
}
public override string Author
{
get
{
return "Jakkee";
}
}
public override Version Version
{
get
{
return new Version("1.0");
}
}
public override void Initialize()
{
Hooks.OnCommand += HandleCommand;
}
public override void DeInitialize()
{
Hooks.OnCommand -= HandleCommand;
}
public void HandleCommand(Fougerite.Player player, string cmd, string[] args)
{
if (cmd == "TestC")
{
var donatorrank = GlobalPluginCollector.GetPlugin(GlobalPluginCollector.GetPluginCollector(), "DonatorRank");
var rank = donatorrank.Invoke("CheckPerm", player.SteamID, "Rank");
player.Message("Your rank is: " + rank);
}
}
}
}
Python to Lua & Python to Lua to Python always return Nil
Python:
if cmd == "f":
lua = Fougerite.GlobalPluginCollector.GetPlugin(Fougerite.GlobalPluginCollector.GetPluginCollector(), "LuaTest")
result = lua.Invoke("TestFunction", Player.SteamID)
Util.Log(result)
Code:
function TestFunction(SteamID)
donatorrank = Fougerite.GlobalPluginCollector.GetPlugin(Fougerite.GlobalPluginCollector.GetPluginCollector(), "DonatorRank")
rank = donatorrank.Invoke("CheckPerm", SteamID, "Rank")
return rank
end
Error:
Code:
[6/21/2016 10:55:11 PM] [Error] [MoonSharp] Error in plugin LuaTest:
[6/21/2016 10:55:11 PM] [Error] [MoonSharp] Invoke failed: MoonSharp.Interpreter.ScriptRuntimeException: attempt to index a nil value
at MoonSharp.Interpreter.Execution.VM.Processor.ExecIndex (MoonSharp.Interpreter.Execution.VM.Instruction i, Int32 instructionPtr) [0x00000] in <filename unknown>:0
at MoonSharp.Interpreter.Execution.VM.Processor.Processing_Loop (Int32 instructionPtr) [0x00000] in <filename unknown>:0
BUT
Doing Python to Lua and in the lua function Util.Log("Blah Blah") will work, Just seems it doesn't want to return any values (Above error).
Magma's invoke is internal use only.
Haven't tried C#
------------------------------------------------------------------------------------------------------------------------
EDIT:
trying to do C#, It will not compile
Code:
Severity Code Description Project File Line Suppression State
Error CS1501 No overload for method 'GetPlugin' takes 2 arguments CTestPlugin C:\Users\****\Desktop\CTestPlugin\CTestPlugin\Class1.cs 51 Active
Severity Code Description Project File Line Suppression State
Error CS1061 'object' does not contain a definition for 'Invoke' and no extension method 'Invoke' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) CTestPlugin C:\Users\****\Desktop\CTestPlugin\CTestPlugin\Class1.cs 52 Active
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Fougerite;
using IronPythonModule;
using MagmaModule;
namespace CTestPlugin
{
public class CTestPlugin : Fougerite.Module
{
public override string Name
{
get
{
return "CTestPlugin";
}
}
public override string Author
{
get
{
return "Jakkee";
}
}
public override Version Version
{
get
{
return new Version("1.0");
}
}
public override void Initialize()
{
Hooks.OnCommand += HandleCommand;
}
public override void DeInitialize()
{
Hooks.OnCommand -= HandleCommand;
}
public void HandleCommand(Fougerite.Player player, string cmd, string[] args)
{
if (cmd == "TestC")
{
var donatorrank = GlobalPluginCollector.GetPlugin(GlobalPluginCollector.GetPluginCollector(), "DonatorRank");
var rank = donatorrank.Invoke("CheckPerm", player.SteamID, "Rank");
player.Message("Your rank is: " + rank);
}
}
}
}
Python to Lua & Python to Lua to Python always return Nil
Python:
if cmd == "f":
lua = Fougerite.GlobalPluginCollector.GetPlugin(Fougerite.GlobalPluginCollector.GetPluginCollector(), "LuaTest")
result = lua.Invoke("TestFunction", Player.SteamID)
Util.Log(result)
Code:
function TestFunction(SteamID)
donatorrank = Fougerite.GlobalPluginCollector.GetPlugin(Fougerite.GlobalPluginCollector.GetPluginCollector(), "DonatorRank")
rank = donatorrank.Invoke("CheckPerm", SteamID, "Rank")
return rank
end
Error:
Code:
[6/21/2016 10:55:11 PM] [Error] [MoonSharp] Error in plugin LuaTest:
[6/21/2016 10:55:11 PM] [Error] [MoonSharp] Invoke failed: MoonSharp.Interpreter.ScriptRuntimeException: attempt to index a nil value
at MoonSharp.Interpreter.Execution.VM.Processor.ExecIndex (MoonSharp.Interpreter.Execution.VM.Instruction i, Int32 instructionPtr) [0x00000] in <filename unknown>:0
at MoonSharp.Interpreter.Execution.VM.Processor.Processing_Loop (Int32 instructionPtr) [0x00000] in <filename unknown>:0
BUT
Doing Python to Lua and in the lua function Util.Log("Blah Blah") will work, Just seems it doesn't want to return any values (Above error).
Magma's invoke is internal use only.
Haven't tried C#
------------------------------------------------------------------------------------------------------------------------
EDIT:
trying to do C#, It will not compile
Code:
Severity Code Description Project File Line Suppression State
Error CS1501 No overload for method 'GetPlugin' takes 2 arguments CTestPlugin C:\Users\****\Desktop\CTestPlugin\CTestPlugin\Class1.cs 51 Active
Severity Code Description Project File Line Suppression State
Error CS1061 'object' does not contain a definition for 'Invoke' and no extension method 'Invoke' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) CTestPlugin C:\Users\****\Desktop\CTestPlugin\CTestPlugin\Class1.cs 52 Active
C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Fougerite;
using IronPythonModule;
using MagmaModule;
namespace CTestPlugin
{
public class CTestPlugin : Fougerite.Module
{
public override string Name
{
get
{
return "CTestPlugin";
}
}
public override string Author
{
get
{
return "Jakkee";
}
}
public override Version Version
{
get
{
return new Version("1.0");
}
}
public override void Initialize()
{
Hooks.OnCommand += HandleCommand;
}
public override void DeInitialize()
{
Hooks.OnCommand -= HandleCommand;
}
public void HandleCommand(Fougerite.Player player, string cmd, string[] args)
{
if (cmd == "TestC")
{
var donatorrank = GlobalPluginCollector.GetPlugin(GlobalPluginCollector.GetPluginCollector(), "DonatorRank");
var rank = donatorrank.Invoke("CheckPerm", player.SteamID, "Rank");
player.Message("Your rank is: " + rank);
}
}
}
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.