• Lua开发环境配置


    Lua英语发音:/ˈlə/程序设计语言是一个简洁、轻量、可扩展的脚本语言,是葡萄牙语中“Luna”(月亮)的意思。

    Lua is a powerful, fast, lightweight, embeddable scripting language.

    Lua是一种功能强大,高效,轻量级的嵌入式脚本语言。

     

    Introduction

    Lua is an extension programming language designed to support general procedural programming with data description facilities. It also offers good support for object-oriented programming, functional programming, and data-driven programming. Lua is intended to be used as a powerful, light-weight scripting language for any program that needs one. Lua is implemented as a library, written in clean C (that is, in the common subset of ANSI C and C++).

    Being an extension language, Lua has no notion of a "main" program: it only works embedded in a host client, called the embedding program or simply the host. This host program can invoke functions to execute a piece of Lua code, can write and read Lua variables, and can register C functions to be called by Lua code. Through the use of C functions, Lua can be augmented to cope with a wide range of different domains, thus creating customized programming languages sharing a syntactical framework. The Lua distribution includes a sample host program called lua, which uses the Lua library to offer a complete, stand-alone Lua interpreter.

    作为一种扩展性语言,Lua没有主函数(Main函数)的概念,它只能嵌入在主机的客户端,被称为嵌入式程序或者简单的主机。这个主机程序可以调用函数去执行Lua代码片段,还可以读写Lua变量,可以通过调用Lua代码来注册C语言函数。通过使用C语言函数,Lua能够得到扩充和增强以处理应付大范围的不同领域,通过共享语法框架来创建自定义编程语言。

    Lua分发包含一个名为“lua”示例主机程序,使用Lua类库来提供一个完整的,独立的Lua解释器。

    Lua特性:

    Lua是一种轻量语言,它的官方版本只包括一个精简的核心和最基本的库。这使得Lua体积小、启动速度快。它用标准C语言编写并以源代码形式开放,编译后仅仅一百余K,可以很方便的嵌入别的程序里。和许多"大而全"的语言不一样,网路通讯、图形界面等都没有默认提供。但是Lua可以很容易地被扩展:由宿主语言(通常是C或C++)提供这些功能,Lua可以使用它们,就像是本来就内置的功能一样。事实上,现在已经有很多成熟的扩展模块可供选用。

    Lua是一种多重编程范式的程序设计语言:它只提供了很小的一个特性集合来满足不同编辑范式的需要,而不是为某种特定的编辑范式提供繁杂的特性支持。例如,Lua并不提供继承这个特性,但是你可以用元表来模拟它。诸如名字空间这些概念都没有在语言基本特性中实现,但是我们可以用表结构(Lua唯一提供的复杂数据结构)轻易模拟。Lua可以在运行时随时构造出一个函数,并把它看作一个对象(正是所谓的first class function),这个特性可以很好的满足函数式编程的需要。这是提供了这些基本的元特性,我们可以任意的对语言进行自需的改造。

    Lua原生支持的数据类型非常之少,它只提供了数字(缺省是双精度浮点数,可配置)、布尔量、字符串、表、子程序协程(coroutine)以及用户自定义数据这几种。但是其处理表和字符串的效率非常之高,加上元表的支持,开发者可以高效的模拟出需要的复杂数据类型(比如集合、数组等)。

    Lua是一个动态弱类型语言,支持增量式垃圾收集策略。有内建的,与操作系统无关的协作式多线程(coroutine)支持。

    转自:http://zh.wikipedia.org/wiki/Lua

    Eclipse,安装LDT http://www.eclipse.org/koneki/ldt/

    Add the following repository: http://download.eclipse.org/koneki/releases/stablefrom the "Help > Install New Software..." menu of your Eclipse 3.7+ workbench, and then check the "Lua Development Tools" feature.
    Should you want to install a different version than the latest stable one, check on the wiki the other update repositories available.

    Alternatively, you can install LDT using the Eclipse Marketplace.
    Just drag and drop the following button into your running Eclipse workbench, and the installation will begin!

    windows使用Lua:

    1.使用LuaForWindows

    Lua for Windows 为 Windows 系统下提供了 Lua 脚本语言的开发和运行环境,很多东西配套好了。

    直接像python一样安装一下,安装时把SciTe编辑器也选择上,像头文件,库什么的都直接放好了。

    推荐这种方法。

    下载地址:http://code.google.com/p/luaforwindows/

     

    2.Script.Net的IDE环境

    蓝蚂蚁软件工作室的一个作品,用着感觉不错,用这个也是相当的方便,最主要的是它有vc番茄一样的提示

    下载地址:http://www.blueantstudio.net

    先下载 基础安装包,再下载安装Lua开发包

    3.lua在VS2010环境下的配置

     ①、在包含目录中添加LuaForWindows安装目录下的include文件夹的路径.我的在WIN7下的路径为:C:Program FilesLua5.1include. 

      ②、在库目录中添加LuaForWindows安装目录下的lib文件夹的路径.我的在WIN7下的路径为:C:Program FilesLua5.1lib.

      ③、在连接器->输入->附加依赖项中添加 lua5.1.lib、lua51.lib

    参考:http://blog.csdn.net/wade333777/article/details/20163725

    LuaForwindows是一套完整的Lua开发环境,包括:

    1. Lua Interpreter(Lua解释器)   
    2. Lua Reference Manual(Lua参考手册)   
    3. Quick Lua Tour (Lua快速入门)   
    4. Examples (Lua范例) 

    Libraries with documentation (一些Lua库和文档) ,SciTE (一个很棒的多用途编辑器,已经对Lua做了特殊设置),之OOXX研究院所以推荐这套环境是由于它整合了在windows学习和开发Lua所需要的所有东西,对于新手来说长短常体贴的,附带的SciTE只要经由简朴配置就能够很利便的编写Lua程序,编译,运行,调试。它仍是附带自动提示和代码自动补全功能的哦,对于用惯VC + VA的开发职员来说,其实是太亲切了。

    最开始安装LuaForwindows总是失败,因为它查找vcredist_x86.exe。官方解释说:

    Lua for Windows installs Lua language, SciTE based Lua IDE and Lua modules to the directory of you choice at install time. Lua for Windows and it's modules all depend on the MSVC++ 2005 runtime library. Lua for Windows install will automatically download this runtime and install it for you if you don't have runtime installed on your computer. The runtime is contained in the file vcredist_x86.exe, if you don't want this download to occur at installation then place the vcredist_86.exe in same directory as Lua for Windows install exe.

    但是我总是下载失败,手动下载这个文件和Luaforwindows在同一个目录就可以了。ok,解决了问题。

    打开SCiTe:

    hello world

    文件需要保存之后才能运行。

    在线测试Lua代码:

    http://www.lua.org/cgi-bin/demo

    http://www.cnweblog.com/fly2700/archive/2010/02/09/282920.html

    lua教程:

    http://metalua.luaforge.net/quicktour.html

  • 相关阅读:
    SQL 学习笔记(一)联表查询
    .NET (OleDb) Access 各个版本的连接字符口串
    加油站
    程序员的编程套路
    落单的数
    读《怎样解题》
    使用org-mode写cnblogs博客
    Emacs 25.1 error solved: url-http-create-request: Multibyte text in HTTP request
    二进制表示小数
    快速幂
  • 原文地址:https://www.cnblogs.com/youxin/p/3670739.html
Copyright © 2020-2023  润新知