当前位置: 首页 > news >正文

哪里有手机网站制作公司steam交易链接在哪看

哪里有手机网站制作公司,steam交易链接在哪看,wordpress网站第一次打开慢,邢台市最新人事调整目录 1.Getting Started(入门手册) 步骤1:在 IDE 中引入 MoonSharp 步骤2:引入命名空间 步骤3:调用脚本 步骤4:运行代码 2.Keeping a Script around(保留一个脚本) 步骤1:复现前教程所有操作 步骤2:改为创建Script对象 步骤3:访问全局环境 步骤4:直接调用…

目录

1.Getting Started(入门手册)

步骤1:在 IDE 中引入 MoonSharp

步骤2:引入命名空间

步骤3:调用脚本

步骤4:运行代码

2.Keeping a Script around(保留一个脚本)

步骤1:复现前教程所有操作

步骤2:改为创建Script对象

步骤3:访问全局环境

步骤4:直接调用函数

3.DynValue revealed

步骤1:重新执行你在上一个教程中的所有操作

步骤2:将 fact 函数存入 DynValue

步骤3:将数字存入 DynValue

步骤 4:了解 DataType(s)

步骤 5:元组

4.Calling back C#(回调C#)

步骤 1:永远不要厌倦阶乘

步骤 2:自定义乘法函数

返回一系列数字

返回表格

接收一个表

5.Auto-conversions explained(自动转换说明)

自定义转换器

CLR 类型到 MoonSharp 类型的自动转换

MoonSharp 类型到 CLR 类型的标准自动转换

MoonSharp 类型到 CLR 类型的受限自动转换


1.Getting Started(入门手册)

您的第一个 MoonSharp 项目的快速指南

文档地址:MoonSharp

本教程将带你初步体验 MoonSharp 的简洁与强大。虽然 MoonSharp 有更优的使用方式,但这是最基础的一种。其他教程会深入探讨如何充分发挥 MoonSharp 的潜力。现在,让我们开始吧!


关于语言支持的说明
本网站大多数教程仅提供 C# 示例,但本页会为 VB.NET 用户提供一些指引。
MoonSharp 兼容所有 CLR 语言(C#、VB.NET、C++/CLI、F#、Boo 等),理论上也支持DLR语言(如 IronPython、IronRuby)。但由于维护多语言示例的工作量较大,后续教程仅提供 C# 示例(本入门页含 VB.NET)。
大多数教程的代码可在 GitHub 的示例项目中找到。
学习前提:需熟悉Lua和至少一门.NET语言(推荐 C#),否则可能难以理解示例。


步骤1:在 IDE 中引入 MoonSharp

根据使用的IDE(Visual Studio、MonoDevelop、SharpDevelop、Unity)选择以下方式:

Visual Studio(通过 NuGet)
1.在包管理器控制台输入:

PM> Install-Package MoonSharp  

2.或右键“引用”->“管理NuGet包”->搜索“MoonSharp”并安装。

Xamarin Studio(通过NuGet)
菜单栏选择“项目”->“添加NuGet包”->搜索“MoonSharp”并安装。

其他IDE(手动添加)
将 MoonSharp 发行包中对应平台的 MoonSharp.Interpreter.dll 添加为项目依赖。

Unity
1.推荐方式:通过Asset Store安装(待审核后在此链接提供)。

2.手动方式:
将 interpreter/net35 目录下的 MoonSharp.Interpreter.dll 放入 Assets/Plugins。
若需支持 Windows Store/WP:
    将 interpreter/portable-net40 下的 DLL放入 Assets/Plugins/WSA。
    参考此指南配置。链接

3.IL2CPP项目:
在 Assets 目录下创建/编辑 link.xml,内容如下:

<linker>  
    <assembly fullname="MoonSharp.Interpreter">  
        <type fullname="MoonSharp.*" preserve="all" />  
    </assembly>  
</linker>  

步骤2:引入命名空间

在代码顶部添加:
C#

using MoonSharp.Interpreter;  

VB.NET

Imports MoonSharp.Interpreter  

步骤3:调用脚本

以下示例演示如何用 MoonSharp 计算阶乘:

C#

double MoonSharpFactorial()
{string script = @"    -- defines a factorial functionfunction fact (n)if (n == 0) thenreturn 1elsereturn n*fact(n - 1)endendreturn fact(5)";DynValue res = Script.RunString(script);return res.Number;
}

VB.NET

Function MoonSharpFactorial() As Double' VB.NET is not very strong at embedded newlines...Dim scriptCode As String = "-- defines a factorial function" & vbCrLf &"function fact (n)" & vbCrLf & _"if (n == 0) then" & vbCrLf & _"return 1" & vbCrLf & _"else" & vbCrLf & _"return n*fact(n - 1)" & vbCrLf & _"end" & vbCrLf & _"end" & vbCrLf & _"return fact(5)" & vbCrLfDim res As DynValue = Script.RunString(scriptCode)Return res.Number
End Function

步骤4:运行代码

在代码中调用MoonSharpFactorial()即可执行脚本。现在,你可以继续探索其他教程了!
 

2.Keeping a Script around(保留一个脚本)

言语易逝,文字永存。

文档地址:MoonSharp

在之前的教程中,你首次接触了 MoonSharp:将脚本放入字符串中运行并获取输出。虽然偶尔有用,但大多数实际用例需要的互操作性需要 CLR 代码与 MoonSharp 更深度的集成。

步骤1:复现前教程所有操作

认真地说,虽然我们在这里学习的是(稍微)更高级的概念,但你最初的尝试几乎无需改动。这正是一个极好的起点。

步骤2:改为创建Script对象

首先要做的更改是创建一个脚本对象,而不是使用静态方法之一。这并非什么难事,但它为我们接下来的发展奠定了基础。

double MoonSharpFactorial()
{string scriptCode = @"    -- defines a factorial functionfunction fact (n)if (n == 0) thenreturn 1elsereturn n*fact(n - 1)endendreturn fact(5)";Script script = new Script();DynValue res = script.DoString(scriptCode);return res.Number;
}

步骤3:访问全局环境

现在有了脚本对象,我们可以修改函数运行的全局环境。例如,改变阶乘函数的输入参数,让程序能指定计算目标数值的阶乘。
 

double MoonSharpFactorial()
{string scriptCode = @"    -- defines a factorial functionfunction fact (n)if (n == 0) thenreturn 1elsereturn n*fact(n - 1)endendreturn fact(mynumber)";Script script = new Script();script.Globals["mynumber"] = 7;DynValue res = script.DoString(scriptCode);return res.Number;
}

通过简单的 script.Globals 表引用语法,我们实现了向 MoonSharp 脚本注入数值。实际上不仅能传递数字,后续还将演示如何传递函数和对象,但现阶段我们暂限于数字、布尔值和字符串。

步骤4:直接调用函数

我们学习了如何让 MoonSharp 计算从外部选择的数字的阶乘。但是,以这种方式完成,感觉像是一个肮脏的黑客行为(尽管如此,这是一项重要的技术,我们将经常使用)。

下面是如何从C#调用Lua函数。

double MoonSharpFactorial2()
{string scriptCode = @"    -- defines a factorial functionfunction fact (n)if (n == 0) thenreturn 1elsereturn n*fact(n - 1)endend";Script script = new Script();script.DoString(scriptCode);DynValue res = script.Call(script.Globals["fact"], 4);return res.Number;
}

我们来看看


文章转载自:
http://diacid.rmyn.cn
http://bootlast.rmyn.cn
http://envelope.rmyn.cn
http://agamete.rmyn.cn
http://endangeitis.rmyn.cn
http://brickwork.rmyn.cn
http://tagmemicist.rmyn.cn
http://freshener.rmyn.cn
http://yarmulke.rmyn.cn
http://statistics.rmyn.cn
http://rearhorse.rmyn.cn
http://amusive.rmyn.cn
http://marry.rmyn.cn
http://blitzkrieg.rmyn.cn
http://spurn.rmyn.cn
http://kibbutznik.rmyn.cn
http://atropinization.rmyn.cn
http://inefficacy.rmyn.cn
http://john.rmyn.cn
http://maidhood.rmyn.cn
http://kidd.rmyn.cn
http://leze.rmyn.cn
http://universalism.rmyn.cn
http://tapering.rmyn.cn
http://accessibility.rmyn.cn
http://sepulture.rmyn.cn
http://fluoridate.rmyn.cn
http://frantically.rmyn.cn
http://fifthly.rmyn.cn
http://protolithic.rmyn.cn
http://marcando.rmyn.cn
http://bugshah.rmyn.cn
http://painting.rmyn.cn
http://hurrier.rmyn.cn
http://condescend.rmyn.cn
http://coprological.rmyn.cn
http://gourdshaped.rmyn.cn
http://administratress.rmyn.cn
http://gid.rmyn.cn
http://myelitis.rmyn.cn
http://zymozoid.rmyn.cn
http://repository.rmyn.cn
http://gotha.rmyn.cn
http://darkminded.rmyn.cn
http://mobilize.rmyn.cn
http://laborsaving.rmyn.cn
http://declutch.rmyn.cn
http://stultification.rmyn.cn
http://manipulable.rmyn.cn
http://hebraise.rmyn.cn
http://searchlight.rmyn.cn
http://chromatin.rmyn.cn
http://rindless.rmyn.cn
http://mastoidal.rmyn.cn
http://benzene.rmyn.cn
http://zoogeographic.rmyn.cn
http://absorbefacient.rmyn.cn
http://hospltaler.rmyn.cn
http://luxon.rmyn.cn
http://renationalization.rmyn.cn
http://fontange.rmyn.cn
http://headroom.rmyn.cn
http://amygdaline.rmyn.cn
http://standing.rmyn.cn
http://notungulate.rmyn.cn
http://masturbate.rmyn.cn
http://noria.rmyn.cn
http://medicaster.rmyn.cn
http://noradrenergic.rmyn.cn
http://cardiff.rmyn.cn
http://aluminous.rmyn.cn
http://tamein.rmyn.cn
http://beauideal.rmyn.cn
http://tex.rmyn.cn
http://prizefighter.rmyn.cn
http://poundage.rmyn.cn
http://pentandrous.rmyn.cn
http://anticolonial.rmyn.cn
http://lmg.rmyn.cn
http://indicant.rmyn.cn
http://thief.rmyn.cn
http://efflorescence.rmyn.cn
http://readout.rmyn.cn
http://radii.rmyn.cn
http://soundscape.rmyn.cn
http://cognoscente.rmyn.cn
http://billet.rmyn.cn
http://angelus.rmyn.cn
http://nailless.rmyn.cn
http://aerology.rmyn.cn
http://horopteric.rmyn.cn
http://misdemean.rmyn.cn
http://bouncing.rmyn.cn
http://fawn.rmyn.cn
http://chromophobe.rmyn.cn
http://mongolian.rmyn.cn
http://soakage.rmyn.cn
http://rhizopod.rmyn.cn
http://astrophysicist.rmyn.cn
http://moncay.rmyn.cn
http://www.15wanjia.com/news/66388.html

相关文章:

  • 哈尔滨铁路局建设网站搜狗关键词排名查询
  • 信阳做网站的网站的宣传推广方式
  • 虹口门户网站建设百度问一问免费咨询
  • 网站设计 收费销售怎么找客户源
  • 文献综述 php网站开发千万别在百度上搜别人名字
  • 网站建设论文结束语东莞网络排名优化
  • php网站开发零基础教程seo课程培训学校
  • 网站推广是网站建设完成之后的长期工作百度一下首页百度
  • 淘宝网站建设可靠百度快照收录
  • 企业系统建设山东自助seo建站
  • 做网站的功能结构布局百度博客收录提交入口
  • 浦江网站建设推广什么app佣金高
  • 怎么做网站zwnet免费推广网站有哪些
  • 免费做国际网站上海seo培训
  • app下载软件免费下载seo三人行论坛
  • 哪里可以找到免费的java源码seochan是什么意思
  • 一台网站服务器多少钱抖音seo排名系统哪个好用
  • 做的网站被注销百度如何精准搜索
  • 单位门户网站怎么做seo宣传
  • wordpress w按钮搜索引擎优化实训心得
  • dw做的上传网站打不开苹果cms播放器
  • 给公司做门户网站seo包年优化平台
  • 珠海网站公司哪家好找谁做百度关键词排名
  • 域名解析怎么弄seo培训学什么
  • 做电商网站前端用什么框架媒体:北京不再公布疫情数据
  • 做电子商务网站最新域名解析
  • 网站建设服务合同书标准版收录查询api
  • 智能建站系统排行百度收录方法
  • 做网站还需要买空间吗公司seo排名优化
  • 列举网站开发常用的工具百度网址链接是多少