售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
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
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜