万本电子书0元读

万本电子书0元读

顶部广告

Lua Quick Start Guide电子书

售       价:¥

19人正在读 | 0人评论 6.2

作       者:Gabor Szauer

出  版  社:Packt Publishing

出版时间:2018-07-27

字       数:21.1万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
The easiest way to learn Lua programming Key Features *The easiest way to learn Lua coding *Use the Lua standard libraries and debug Lua code *Embed Lua as a scripting language using the Lua C API Book Description Lua is a small, powerful and extendable scripting/programming language that can be used for learning to program, and writing games and applications, or as an embedded scripting language. There are many popular commercial projects that allow you to modify or extend them through Lua scripting, and this book will get you ready for that. This book is the easiest way to learn Lua. It introduces you to the basics of Lua and helps you to understand the problems it solves. You will work with the basic language features, the libraries Lua provides, and powerful topics such as object-oriented programming. Every aspect of programming in Lua, variables, data types, functions, tables, arrays and objects, is covered in sufficient detail for you to get started. You will also find out about Lua's module system and how to interface with the operating system. After reading this book, you will be ready to use Lua as a programming language to write code that can interface with the operating system, automate tasks, make playable games, and much more. This book is a solid starting point for those who want to learn Lua in order to move onto other technologies such as Love2D or Roblox. A quick start guide is a focused, shorter title that provides a faster paced introduction to a technology. It is designed for people who don't need all the details at this point in their learning curve. This presentation has been streamlined to concentrate on the things you really need to know. What you will learn *Understand the basics of programming the Lua language *Understand how to use tables, the data structure that makes Lua so powerful *Understand object-oriented programming in Lua using metatables *Understand standard LUA libraries for math, file io, and more *Manipulate string data using Lua *Understand how to debug Lua applications quickly and effciently *Understand how to embed Lua into applications with the Lua C API Who this book is for This book is for developers who want to get up and running with Lua. This book is ideal for programmers who want to learn to embed Lua in their own applications, as well as for beginner programmers who have never coded before.
目录展开

Title Page

Copyright and Credits

Lua Quick Start Guide

Packt Upsell

Why subscribe?

PacktPub.com

Contributors

About the author

About the reviewer

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Download the color images

Code in Action

Conventions used

Get in touch

Reviews

Introduction to Lua

Technical requirements

What Lua is

Source code and binaries

Installing Lua on Windows 10

Installing Lua on macOS

Installing Lua on Linux

Tools for Lua

Installing VS Code on Windows 10

Installing VS Code on macOS

Installing VS Code on Linux

Exploring VS Code

Hello World!

Summary

Working with Lua

Technical requirements

Variables

Creating variables

Printing variables

Assigning variables

Comments

Basic types

nil

Boolean

number

Finding a type

String types

String literals

String length

Concatenate strings

String coercion

Escape characters

Console input

Scope

Scope access

Global scope

Shadowing

Functions

Defining a function

Calling a function

Function arguments

Any number of arguments

Returning a value

Returning multiple values

Operators

Arithmetic operators

Relational operators

Logical operators

Misc operators

Operator precedence

Control structures

if

elseif

else

Nesting if statements

Loops

while loops

Infinite loops

Breaking a loop

Repeat until loop

for loop

Nested loops

Summary

Tables and Objects

Technical requirements

Introduction to tables

Creating tables

Storing values

Table constructor

Tables are references

Arrays

Array constructor

Arrays are one-based

Sparse arrays

The size of an array

Multidimensional arrays

Iterating

Understanding pairs

Understanding ipairs

Closures

Iterator functions

Meta tables

setmetatable

getmetatable

__index

__newindex

rawget and rawset

__call

Operators

Math operators

Equivalence operators

Other operators

Objects

Classes

The : operator

Tables inside of objects

Inheritance

Single inheritance

Multiple inheritance

Summary

Lua Libraries

Technical requirements

The global table

Explicit variables

Dynamic variables

Environment

math

Trigonometry

Changing numbers

Comparing numbers

Randomness

Constants

Everything else

File IO

Opening a file

Writing data

Reading data

Reading line by line

Reading bits of data

Closing a file

Interfacing with the operating system

Working with time

Interacting with the shell

Working with files

More strings

Searching for a substring

Extracting a substring

Case manipulation

Creating and loading modules

Creating a module

Loading and using modules

Avoiding parsing

Executing files

Summary

Debugging Lua

Technical requirements

The debug library

Introspective information

The debug.getinfo return value

Filtering the information

Local variables

Hooks

Line ("l")

Call ("c")

Return ("r")

Setting a counter

Multiple hooks

Traceback

Debugger.lua

Using debugger.lua

Error-handling in Lua

pcall and error

assert

Profiling

The profile module

Using the profile module

Integrated development environments

LuaEdit

Breakpoints

Locals and Watch

Callstack

Decoda

Starting debugging

Everything else

Zero Brane Studio

Selecting an interpreter

Starting the debugger

Visual Studio Code

Summary

Embedding Lua

Technical requirements

Working with the C API

The stack

Pushing to the stack

Querying the stack

Reading from the stack

Stack size

Reading Lua variables from C

Loading a Lua file

Reading global variables

Example

Creating Lua variables from C

Calling Lua functions from C

Calling C functions from Lua

Working with tables in C

Reading values from a table

Writing values to a table

Meta tables

User data

Lua C API reference

Summary

Lua Bridge

Technical requirements

API conventions

Namespaces

Variables

Functions

Properties

Classes

Constructor

Subclass

Member variables, properties, and functions

Static variables, properties, and functions

Calling C functions from Lua

LuaRef

LuaRef and tables

Summary

Next Steps

Books

Programming In Lua

Learning Game AI Programming with Lua

LÖVE for Lua Game Programming

Lua Game Development Cookbook

Game Development with Lua

Beginning Lua Programming

Lua Programming Gems

Learn Lua for iOS Game Development

Game engines

LÖVE 2D

Defold

Corona

Leadwerks

Gideros

Urho 3D

Polycode

ShiVa

Game mods

Roblox

Garry's Mod

World Of Warcraft

Natural Selection 2

Don't Starve

Hack 'n' Slash

Scriptable software

CEGUI

Conky

Premake

Moho

Summary

Other Books You May Enjoy

Leave a review - let other readers know what you think

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部