中文字幕理论片,69视频免费在线观看,亚洲成人app,国产1级毛片,刘涛最大尺度戏视频,欧美亚洲美女视频,2021韩国美女仙女屋vip视频

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
MoonScript, a language that compiles to Lua

MoonScript is a dynamic scripting language that compiles intoLua. It gives you the power of one of the fastestscripting languages combined with a rich set of features.

class Thing  name: "unknown"class Person extends Thing  say_name: => print "Hello, I am", @namewith Person!  .name = "MoonScript"  \say_name!

MoonScript can either be compiled into Lua and run at a later time, or it canbe dynamically compiled and run using the moonloader. It’s as simple asrequire "moonscript" in order to have Lua understand how to load and run anyMoonScript file.

Because it compiles right into Lua code, it is completely compatible withalternative Lua implementations like LuaJIT, and it isalso compatible with all existing Lua code and libraries.

The command line tools also let you run MoonScript directly from thecommand line, like any first-class scripting language.

A comprehensive overview of the language can be found in the referencemanual, the rest of this page serves as an overview of thelanguage.

Overview

MoonScript provides a clean syntax using significant whitespace that avoids allthe keyword noise typically seen in a Lua script. Below is a sample of someconstructs found in the language.

export my_funcx = 2323collection =  height: 32434  hats: {"tophat", "bball", "bowler"}my_func = (a) -> x + aprint my_func 100

It also adds table comprehensions, implicit return on functions, classes,inheritance, scope management statements import & export, and a convenientobject creation statement called with.

import concat, insert from tabledouble_args = (...) ->  [x * 2 for x in *{...}]tuples = [{k, v} for k,v in ipairs my_table]

It can be loaded directly from a Lua script without an intermediatecompile step. It even knows how to tell youwhere errors occurred in the original file whenthey happen.

Installation

Installing with LuaRocks

If you're on Windows, then install the Windows binaries,otherwise the easiest way to install is to use LuaRocks.

LuaRocks can be obtained here or from your packagemanager.

After it is installed, run the following in a terminal:

$ luarocks install moonscript

This will provide the moon and moonc executables along with themoonscript and moon Lua module.

Windows Binaries

Procompiled Windows binaries are available to avoid the trouble of compiling:
http://moonscript.org/bin/moonscript-0.2.4.zip

Extract the contents into your PATH.

Optional

If you're on Linux and use watch mode (which compiles .moon files to .luafiles as they are changed) you can installlinotify to use inotify instead ofpolling.

Source

The source code to the project lives on github:
https://github.com/leafo/moonscript

Issues with the tool can be reported on the issue tracker:
https://github.com/leafo/moonscript/issues

The latest development version can be installed with the dev rockspec:

$ luarocks build http://moonscript.org/rocks/moonscript-dev-1.rockspec

Dependencies

In addition to Lua 5.1 or 5.2, the following Lua modules arerequired to run the compiler and associated tools:

All of the required ones can be retrieved automatically using theLuaRocks installation.

Extras & Addons

Editor Support

Vim syntax and indent:
https://github.com/leafo/moonscript-vim

Textmate (and Sublime Text) syntax and indent:
https://github.com/leafo/moonscript-tmbundle

SciTE (with scintillua) syntax:
https://github.com/leafo/moonscript/tree/master/extra/scintillua

Preconfigured and packaged version of SciTE for Windows with MoonScriptsupport:
http://moonscript.org/scite/

Tools

Online Compiler:
http://moonscript.org/compiler/

Overview of Differences & Highlights

A more detailed overview of the syntax can be found in thedocumentation.

  • Whitespace sensitive blocks defined by indenting
  • All variable declarations are local by default
  • export keyword to declare global variables, import keyword to make localcopies of values from a table
  • Parentheses are optional for function calls, similar to Ruby
  • Fat arrow, =>, can be used to create a function with a self argument
  • @ can be prefixed in front of a name to refer to that name in self
  • ! operator can be used to call a function with no arguments
  • Implicit return on functions based on the type of last statement
  • : is used to separate key and value in table literals instead of =
  • Newlines can be used as table literal entry delimiters in addition to ,
  • \ is used to call a method on an object instead of :
  • +=, -=, /=, *=, %= operators
  • != is an alias for ~=
  • Table comprehensions, with convenient slicing and iterator syntax
  • Lines can be decorated with for loops and if statements at the end of the line
  • If statements can be used as expressions
  • Class system with inheritance based on metatable’s __index property
  • Constructor arguments can begin with @ to cause them to automatically beassigned to the object
  • Magic super function which maps to super class method of same name in aclass method
  • with statement lets you access anonymous object with short syntax

About

The syntax of MoonScript has been heavily inspired by the syntax ofCoffeeScript. MoonScript isCoffeeScript for Lua.

MoonScript would not have been possible without the excellent toolLPeg for parsing.

Changelog

  • 0.2.4— July 2 2013
  • 0.2.3-2 — Jan 29 2013, Fixed bug with moonloader not loading anything
  • 0.2.3 — Jan 24 2013
  • 0.2.2 — Nov 04 2012
  • 0.2.0 — Dec 11 2011
本站僅提供存儲服務,所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權內(nèi)容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
linux下lua開發(fā)環(huán)境安裝
How to install a MUI language CAB file in Windows 10
Vistalizator
Origin 8.6 對話框字體太小,看不清楚的完美解決方案
How to install and configure speech recognition in Windows XP
Using Multilingual User Interface on Windows Embedded Standard 2009
更多類似文章 >>
生活服務
熱點新聞
分享 收藏 導長圖 關注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服