本文整理汇总了C#中LuaNativeFunction类的典型用法代码示例。如果您正苦于以下问题:C# LuaNativeFunction类的具体用法?C# LuaNativeFunction怎么用?C# LuaNativeFunction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LuaNativeFunction类属于命名空间,在下文中一共展示了LuaNativeFunction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LuaAtPanic
public static LuaNativeFunction LuaAtPanic(LuaState L, LuaNativeFunction panicf)
{
LuaNativeFunction old;
LuaLock(L);
old = G(L).panic;
G(L).panic = panicf;
LuaUnlock(L);
return old;
}
示例2: RegisterTableFunction
/// <summary>
/// Registers the given function to the current table on the stack top.
/// </summary>
/// <param name="state"></param>
/// <param name="name"></param>
/// <param name="func"></param>
public static void RegisterTableFunction(this NLua.Lua state, string name, LuaNativeFunction func)
{
// Do not continue if we are not a table..
var isTable = NLua.LuaLib.LuaType(state.GetState(), -1) == LuaTypes.Table;
if (!isTable)
return;
// Push the name, function, and set the table..
NLua.LuaLib.LuaPushString(state.GetState(), name);
NLua.LuaLib.LuaPushStdCallCFunction(state.GetState(), func);
NLua.LuaLib.LuaRawSet(state.GetState(), -3);
}
示例3: MetaFunctions
public MetaFunctions (ObjectTranslator translator)
{
this.translator = translator;
gcFunction = new LuaNativeFunction (MetaFunctions.CollectObject);
toStringFunction = new LuaNativeFunction (MetaFunctions.ToStringLua);
indexFunction = new LuaNativeFunction (MetaFunctions.GetMethod);
newindexFunction = new LuaNativeFunction (MetaFunctions.SetFieldOrProperty);
baseIndexFunction = new LuaNativeFunction (MetaFunctions.GetBaseMethod);
callConstructorFunction = new LuaNativeFunction (MetaFunctions.CallConstructor);
classIndexFunction = new LuaNativeFunction (MetaFunctions.GetClassMethod);
classNewindexFunction = new LuaNativeFunction (MetaFunctions.SetClassFieldOrProperty);
execDelegateFunction = new LuaNativeFunction (MetaFunctions.RunFunctionDelegate);
}
示例4: LuaMethodWrapper
/*
* Constructs the wrapper for a known MethodBase instance
*/
public LuaMethodWrapper (ObjectTranslator translator, object target, ProxyType targetType, MethodBase method)
{
invokeFunction = new LuaNativeFunction (this.Call);
_Translator = translator;
_Target = target;
if (targetType != null)
_ExtractTarget = translator.typeChecker.GetExtractor (targetType);
_Method = method;
_MethodName = method.Name;
_IsStatic = method.IsStatic;
}
示例5: LuaMethodWrapper
/// <summary>
/// Constructs the wrapper for a known method name
/// </summary>
/// <param name="translator"></param>
/// <param name="targetType"></param>
/// <param name="methodName"></param>
/// <param name="bindingType"></param>
public LuaMethodWrapper(ObjectTranslator translator, IReflect targetType, string methodName, BindingFlags bindingType)
{
invokeFunction = new LuaNativeFunction(this.Call);
_Translator = translator;
_MethodName = methodName;
if (targetType != null)
_ExtractTarget = translator.typeChecker.GetExtractor(targetType);
_BindingType = bindingType;
//CP: Removed NonPublic binding search and added IgnoreCase
_Members = targetType.UnderlyingSystemType.GetMember(methodName, MemberTypes.Method, bindingType | BindingFlags.Public | BindingFlags.IgnoreCase/*|BindingFlags.NonPublic*/);
}
示例6: LuaMethodWrapper
/*
* Constructs the wrapper for a known MethodBase instance
*/
public LuaMethodWrapper (ObjectTranslator translator, object target, IReflect targetType, MethodBase method)
{
invokeFunction = new LuaNativeFunction (this.Call);
_Translator = translator;
_Target = target;
if (targetType != null)
_ExtractTarget = translator.typeChecker.GetExtractor (targetType);
_Method = method;
_MethodName = method.Name;
if (method.IsStatic)
_BindingType = BindingFlags.Static;
else
_BindingType = BindingFlags.Instance;
}
示例7: ObjectTranslator
public ObjectTranslator(Lua interpreter, LuaState luaState)
{
this.interpreter = interpreter;
typeChecker = new CheckType(this);
metaFunctions = new MetaFunctions(this);
assemblies = new List<Assembly>();
importTypeFunction = new LuaNativeFunction(ObjectTranslator.ImportType);
loadAssemblyFunction = new LuaNativeFunction(ObjectTranslator.LoadAssembly);
registerTableFunction = new LuaNativeFunction(ObjectTranslator.RegisterTable);
unregisterTableFunction = new LuaNativeFunction(ObjectTranslator.UnregisterTable);
getMethodSigFunction = new LuaNativeFunction(ObjectTranslator.GetMethodSignature);
getConstructorSigFunction = new LuaNativeFunction(ObjectTranslator.GetConstructorSignature);
ctypeFunction = new LuaNativeFunction(ObjectTranslator.CType);
enumFromIntFunction = new LuaNativeFunction(ObjectTranslator.EnumFromInt);
CreateLuaObjectList(luaState);
CreateIndexingMetaFunction(luaState);
CreateBaseClassMetatable(luaState);
CreateClassMetatable(luaState);
CreateFunctionMetatable(luaState);
SetGlobalFunctions(luaState);
}
示例8: NewFEnv
private static void NewFEnv(LuaState L, LuaNativeFunction cls)
{
LuaCreateTable(L, 0, 1);
LuaPushCFunction(L, cls);
LuaSetField(L, -2, "__close");
}
示例9: LuaPushCFunction
public static void LuaPushCFunction(LuaState L, LuaNativeFunction f)
{
LuaPushCClosure(L, f, 0);
}
示例10: LuaRegister
public static void LuaRegister(LuaState L, CharPtr n, LuaNativeFunction f)
{
LuaPushCFunction(L, f);
LuaSetGlobal(L, n);
}
示例11: LuaLReg
public LuaLReg(CharPtr name, LuaNativeFunction func) {
this.name = name;
this.func = func;
}
示例12: MetaFunctions
public MetaFunctions (ObjectTranslator translator)
{
this.translator = translator;
GcFunction = new LuaNativeFunction (MetaFunctions.CollectObject);
ToStringFunction = new LuaNativeFunction (MetaFunctions.ToStringLua);
IndexFunction = new LuaNativeFunction (MetaFunctions.GetMethod);
NewIndexFunction = new LuaNativeFunction (MetaFunctions.SetFieldOrProperty);
BaseIndexFunction = new LuaNativeFunction (MetaFunctions.GetBaseMethod);
CallConstructorFunction = new LuaNativeFunction (MetaFunctions.CallConstructor);
ClassIndexFunction = new LuaNativeFunction (MetaFunctions.GetClassMethod);
ClassNewindexFunction = new LuaNativeFunction (MetaFunctions.SetClassFieldOrProperty);
ExecuteDelegateFunction = new LuaNativeFunction (MetaFunctions.RunFunctionDelegate);
AddFunction = new LuaNativeFunction (MetaFunctions.AddLua);
SubtractFunction = new LuaNativeFunction (MetaFunctions.SubtractLua);
MultiplyFunction = new LuaNativeFunction (MetaFunctions.MultiplyLua);
DivisionFunction = new LuaNativeFunction (MetaFunctions.DivideLua);
ModulosFunction = new LuaNativeFunction (MetaFunctions.ModLua);
UnaryNegationFunction = new LuaNativeFunction (MetaFunctions.UnaryNegationLua);
EqualFunction = new LuaNativeFunction (MetaFunctions.EqualLua);
LessThanFunction = new LuaNativeFunction (MetaFunctions.LessThanLua);
LessThanOrEqualFunction = new LuaNativeFunction (MetaFunctions.LessThanOrEqualLua);
}
示例13: Lua
public Lua ()
{
luaState = LuaLib.LuaLNewState (); // steffenj: Lua 5.1.1 API change (lua_open is gone)
LuaLib.LuaLOpenLibs (luaState); // steffenj: Lua 5.1.1 API change (luaopen_base is gone, just open all libs right here)
Init ();
// We need to keep this in a managed reference so the delegate doesn't get garbage collected
panicCallback = new LuaNativeFunction (PanicCallback);
LuaLib.LuaAtPanic (luaState, panicCallback);
}
示例14: LuaAtPanic
public static void LuaAtPanic (IntPtr luaState, LuaNativeFunction panicf)
{
IntPtr fnpanic = Marshal.GetFunctionPointerForDelegate (panicf);
NativeMethods.LuaAtPanic (luaState, fnpanic);
}
示例15: Lua
public Lua ()
{
luaState = LuaLib.LuaLNewState ();
LuaLib.LuaLOpenLibs (luaState);
Init ();
// We need to keep this in a managed reference so the delegate doesn't get garbage collected
panicCallback = new LuaNativeFunction (PanicCallback);
LuaLib.LuaAtPanic (luaState, panicCallback);
}