Lua介绍 – 解读Lua官方文档

原文: Lua介绍 – 解读Lua官方文档-阿木笔记

Lua介绍

LUA是一种可扩展的编程语言,它被设计成了支持通用编程方式以及通用数据类型的编程语言。它对面向对象編程,函数式編程,数据驱动编程也提供了很好的支持。LUA是一个强大的轻量脚本语言,可被所需的应用程序所调用。LUA的实现方式为库,用Clean C编写的,是C与C++的子集。

作为一种可扩展的编程语言,LUA并没有主程序(main)的概念,它只是嵌入于宿主程序当中运行(运行LUA的应用程序被称之为宿主程序)。宿主程序调用LUA函数去执行一段LUA代码,就可以读写LUA变量,可以注册被LUA调用的C函数。LUA还支持了C函数,所以LUA可以被增强,以应对各种各样的使用场景。因此可以创造了自定义的编程语言,共享同一个语法框架。LUA发布包里包含一个样本宿主程序,叫LUA(解释器)。它利用LUA库提供一个完整,独立的解释器。

1 – 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.

Published by

风君子

独自遨游何稽首 揭天掀地慰生平