public void SetGlobalField(string fieldName, object para, LuaParaType type) { _luaState.PushGlobalTable(); switch (type) { case LuaParaType.Bool: _luaState.PushBoolean((bool)para); break; case LuaParaType.Int: _luaState.PushInteger((int)para); break; case LuaParaType.LightUserData: _luaState.PushLightUserData(para); break; case LuaParaType.Number: _luaState.PushNumber((double)para); break; case LuaParaType.String: _luaState.PushString((string)para); break; } _luaState.SetField(-2, fieldName); _luaState.Pop(1); }
/// <summary> /// 添加调用lua方法需要的参数 /// </summary> /// <param name="para"></param> /// <param name="type"></param> public void AddPara(object para, LuaParaType type) { LuaPara luaPara = new LuaPara() { paraValue = para, paraType = type }; _funcParas.Add(luaPara); }