Beginning Lua programming

Gespeichert in:
Bibliographische Detailangaben
1. Verfasser: Jung, Kurt (VerfasserIn)
Format: Buch
Sprache:English
Veröffentlicht: Indianapolis, Ind. Wiley, 2007
Schriftenreihe:Programmer to programmer
Schlagworte:
Online-Zugang:Inhaltsverzeichnis
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!

MARC

LEADER 00000nam a2200000zc 4500
001 BV023046267
003 DE-604
005 20111117
007 t|
008 071212s2007 xxu |||| 00||| eng d
020 |a 0470069171  |9 0-470-06917-1 
020 |a 9780470069172  |c (pbk) : £25.99  |9 978-0-470-06917-2 
035 |a (OCoLC)72868224 
035 |a (DE-599)BVBBV023046267 
040 |a DE-604  |b ger  |e aacr 
041 0 |a eng 
044 |a xxu  |c US 
049 |a DE-1051  |a DE-M347  |a DE-91G 
050 0 |a QA76.73.L82 
082 0 |a 005.13/3 
084 |a ST 250  |0 (DE-625)143626:  |2 rvk 
084 |a DAT 364f  |2 stub 
100 1 |a Jung, Kurt  |e Verfasser  |4 aut 
245 1 0 |a Beginning Lua programming  |c Kurt Jung and Aaron Brown 
264 1 |a Indianapolis, Ind.  |b Wiley,  |c 2007 
300 |a XXVIII, 644 S. 
336 |b txt  |2 rdacontent 
337 |b n  |2 rdamedia 
338 |b nc  |2 rdacarrier 
490 0 |a Programmer to programmer 
650 7 |a Lua <Programmiersprache>  |2 swd 
650 4 |a Lua (Computer program language) 
700 1 |a Brown, Aaron  |e Sonstige  |4 oth 
856 4 2 |m HBZ Datenaustausch  |q application/pdf  |u http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=016249722&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA  |3 Inhaltsverzeichnis 
943 1 |a oai:aleph.bib-bvb.de:BVB01-016249722 

Datensatz im Suchindex

DE-BY-TUM_call_number 0102 DAT 364f 2011 A 7639
DE-BY-TUM_katkey 1785603
DE-BY-TUM_location 01
DE-BY-TUM_media_number 040010219148
_version_ 1820800989928620033
adam_text Contents Acknowledgments ix Introduction xxiii Chapter 1: Getting Situated 1 Choosing How to Install Lua 1 Building Lua Yourself 2 Selecting Prebuilt Lua 3 Finding Your System s Shell 3 Windows Shells 3 Shells on Unix and Unix Like Systems 3 Shell Features 4 The Environment 4 Environment Variables on Unix Like Systems 4 Environment Variables on Windows 5 Dealing with Tarballs and Zip Files 6 Compiling Lua 7 The Lua Source Tarball 7 Compiling Lua on Linux and Other Unix Like Systems 8 Compiling Lua on Windows 12 Building Lua with Microsoft Visual C++ 13 Building Lua with the Tiny C Compiler 14 Building Lua with MinGW 16 Binary Packages 18 Selecting a Prebuilt Binary Package 18 Installing a Prebuilt Binary Package on a Unix Type System 19 Installing a Prebuilt Binary Package on Windows 20 Additional Tools 21 Programmer s Editor 21 Revision Control System 22 Summary 22 Chapter 2; First Steps 23 Numbers and Arithmetic Operations: Basic Interpreter Usage 23 Addition, Subtraction, Multiplication, Division, and Exponentiation 24 Interacting with the Interpreter 24 Other Notations for Numbers 25 Interpreter Know How 26 Quitting the Interpreter 26 Interpreter Shortcuts 26 Numerical Gotchas 27 Division by Zero and Overflow 27 Floating Point Rounding 28 Variables and Assignment 28 Assignment Basics 29 Multiple Assignment 31 Variables on the Right Side of Assignments 32 Strings 32 Quoting Strings 32 Quoting Strings with Double Quotes 32 Quoting Strings with Single Quotes 33 Quoting Strings with Square Brackets 33 Backslash Escaping 35 Relational Operators and Boolean Values 37 Comparing Numbers 37 Comparing Strings 38 The nil Value 40 Boolean Operators 41 The and Operator 42 The or Operator 43 The not Unary Operator 44 The Concatenation, Length, and Modulo Operators 45 The String Concatenation Operator 4^ The Length Operator 46 The Modulo Operator 47 Automatic Conversion of Operands 48 Precedence and Associativity 49 Variables and Values 51 Comments ^2 Expressions and Statements 53 Compound Statements 54 The if Statement 55 The while Loop 58 The for Loop 60 The repeat Loop The break and do Statements ®f Summary ®® Exercises 66 Chapter 3: Extending Lua with Functions ߣ Return Values 72 Using a Function that Returns a Value 72 Defining a Function that Returns a Value 73 Using return to Alter Control Flow 74 Returning Nothing 76 Retuming Multiple Values 77 Adjusting Value Lists 78 Using Multiple Valued Functions in Value Lists 78 Using Valueless Functions in Value Lists 79 Chunks as Functions 81 Variable Scope 84 Actual and Formal Arguments 84 Local Variables 85 Understanding Side Effects 91 Ordering Side Effects 91 Short Circuit Evaluation 93 Functions Calling Functions 95 The Call Stack 95 Recursion 97 Stack Overflow 98 Tail Calls 99 Functions as Vaiues 102 Replacing Built In Functions 102 Comparing and Printing Functions 103 Function Definitions as Assignments 103 Local Functions 105 Whitespace, Semicolons, and Function Calls 106 Upvalues and Closures 108 Defining Functions that Create Functions 108 Defining Functions with Private State HO Figuring Out Tricky Scope Situations 111 Summary 113 Exercises 114 Chapter 4: Working with Tables 117 Tables Introduced 117 A Shorter Way to Write Some Keys 119 Altering a Table s Contents 120 Tables as Arrays 121 Array Length 123 Looping through Tables 124 Tables of Functions 128 The Table Library 128 table.sort 128 table.concat 131 table.remove 132 table.maxn 132 Object Oriented Programming with Tables 133 Functions with Variable Numbers of Arguments 136 Defining Vararg Functions 136 Scripts as Vararg Functions 140 Keyword Arguments 143 Different but the Same 144 Table Equality 144 Avoiding Bugs by Understanding Mutability 145 Variables and Mutable Values 145 Tables and Functions 147 Copying Tables 148 Building Other Data Structures from Tables 152 Custom Made Loops 158 Global Variable Environments 163 Summary 168 Exercises 169 Chanter 5: Using Strings 171 Basic String Conversion Functions 171 String Length 173 Converting Between Characters and Character Codes 173 Formatting Strings and Numbers with string.format 174 Input/Output 180 Writing to and Reading from a File 181 Pattern Matching 185 Searching for a Specific String 186 Matching Any of Several Characters 186 Matches of Varying Length s 193 Captures 198 Matching Balanced Delimiters 202 More on string.find, string.match, and string.gsub 202 Iterating Through All Matches 204 Tricks for the Tricky 207 Magic Characters Chart 209 Summary 210 ^ • Ä ^ ä Chapter 6: Handling and Avoiding Errors 213 Kinds of Errors 213 Syntax Errors 213 Runtime Errors 217 Handling Errors 218 Default Error Behavior 218 Checking Assumptions 219 Code Errors 220 Data Errors 220 The assert and error Functions 220 Defining Your Own Error Condition 221 Anticipating Error Conditions 222 Working with Return Values 222 Structuring Code 224 Error Containment Functions 227 The pcall Function 227 The xpcall Function 229 User Written Scripts 230 Locating Errors 230 Summary 230 Exercises 231 Chapter 7: Using Modules 233 Interfaces and Implementations 233 The require Function 234 Where to Put Modules 235 Creating a Module Directory 235 Setting Lua s Environment Variable 236 Preserving a Module s Interface 236 Module Bookkeeping 240 Bytecode 241 Namespaces 242 Creating and Reusing Namespaces 242 Avoiding Global Variables 244 Using the strict Module 244 Reporting All Global Assignments 244 The module Function 245 C Modules 247 Summary 247 Exercises 247 Chapter 8: Extending Lua s Behavior with Metamethods 249 Using Concatenation and Arithmetical Operators on Tables 249 Relational Metamethods 257 Indexing and Call Metamethods 258 Non Tables with Metamethods 265 Non Syntactical Metamethods 267 Metamethod Applicability 268 Summary 268 Exercises 269 Chapter 9: Handling Events Naturallv with Coroutines 27.1 Coroutines and Program Control 271 Coroutines Are Not Functions 272 How Coroutines Are Like Programs 272 Coroutines Transfer Control Wrapping a Coroutine 273 Coroutines Are Cooperative 273 Outside Looking In 275 Coroutines Have Status 278 Rules of Conduct 279 Work Shoulder to Shoulder 279 Trust the Dispatcher 280 Expect the Best, Prepare for the Worst 280 Play on Your Side of the Fence 280 Avoid the Deep End 281 Managing Concurrent Tasks 281 Retaining State 282 Exercising a Coroutine s Memory 282 Iterating with Coroutines 286 Handling Events Simply 287 The Event Loop 288 Yielding to Another Coroutine 296 Summary 297 Exercises 297 Charter 10: Looking Uncter th? h™h ^ Bytecode and luac 299 Garbage Collection 303 The Implementation of Tables and Strings 307 The Debug Library 308 Inspecting and Manipulating Running Code 308 Hooks 315 Other Functions in the Debug Library 321 Summary 321 Exercises 322 Chapter 11: Exploring Lua s Libraries 325 Core Library 325 Environment Functions 326 Metatable Functions 326 Chunk Loading Functions 328 Error Containment Functions 330 Module Functions 331 The Garbage Collection Function 332 Type and Conversion Functions 333 Basic Output 333 Error Condition Functions 333 Table Traversal Functions 334 Vararg Related Functions 335 Coroutine Library 336 Package Library 338 String Library 340 Pattern Based String Functions 340 String Conversion Functions 342 Table Library 344 Math Library 345 Trigonometrie Functions 345 Inverse Trigonometrie Functions 348 Hyperbolic Functions 351 Exponent Functions 354 Logarithm Functions 356 Adjustment Functions 358 Floating Point Representation 360 Angle Conversion Functions 361 Pseudo Random Number Functions 362 Modulus Functions 362 Minimum and Maximum Functions 363 Constants 363 Input/Output Library 364 Operating System Library 368 CPU Timing 368 Time and Date Functions 368 Filesystem Functions 3* 9 Other Operating System Functions 37° Debugging Library 370 Summary 373 Chapter 12: Using Community Libraries _ 315 Library Overview 375 Dynamically Linked Libraries 37^ Resolving External References 376 Configuration Options 376 Libraries Built from Source Code 377 Building Libraries on Unix Like Systems 378 Building Libraries on Windows 378 Limits to Portability 379 How Lua Interacts with Libraries 379 The Variable Registration Process 379 Calling a C Function from Lua 380 The pack Binary Structuring Library 383 Building the pack Library on Unix type Systems 383 Building and Installing the pack Library on Windows 384 Testing the pack Library 384 Installing the pack Library 38^ Using the pack Library 38^ The cURL File Transfer Library 389 Building libcurl 389 Building libcurl on Unix Like Systems 390 Building libcurl on Windows 391 Building luacurl 392 Building luacurl on Unix Like Systems 392 Building luacurl on Windows 393 Using luacurl 393 The gd Graphics Library 395 Building gd 395 Building gd on Unix Like Systems 396 Installing gd on Windows 396 Building lua gd 397 Building lua gd on Unix Like Systems 397 Building lua gd on Windows 398 Using lua gd 3 The SQLite Database Library 405 Building SQLite3 405 Building SQLite3 on Unix Like Systems 405 Building SQLite3 on Windows 406 Building Iua sqlite3 407 Building Iua sqlite3 on Unix Like Systems 407 Building Iua sqlite3 on Windows 408 Using Iua sqlite3 409 Summary 411 Exercises 412 Chapter 13: Interfacing Lua with Other Languages 413 How C Programs Use Lua 413 Embedding Lua 414 Extending Lua 414 Embedding or Extending: Which Is Best? 414 Communicating Between Lua and C 415 Calling Lua from C 421 Obtaining a Lua Function 421 Calling a Lua Function 421 Protected Calls 422 Working with Userdata 423 Indexing Values in C 436 Retrieving Indexed Values 436 Setting Indexed Values 437 Retaining Values in C 438 The Registry 438 C Function Environments 439 Upvalues in C 439 Referencing Values 440 The Thread Environment 441 Layering Your Extension Library 441 Summary 447 Exercises 448 Chapter 14: Managing Information with Databases 44S Some Basic Relational Database Concepts 449 SQL, LuaSQL, and MySQL 458 Summary 466 Exercises 466 Chaoter 15: Programming for the Web 4fil A Web Server Primer 4jj7 Dynamic Web Content 468 Embedded Web Server 468 Extended Web Server 469 Creating Content at Run Time with Lua 469 Executing CGI Scripts 469 CGI Scripts on Unix Type Systems 470 CGI Scripts on Windows 470 Installing a Web Server 471 Apache 471 TinyWeb 472 Testing Your Web Server with Static Content 474 Serving Dynamic Web Content 474 Problems with CGI Scripts 475 Asynchronous Calls to the Server 47° Producing a Calendar Dynamically 47° Producing Charts Dynamically 48 Interactive CGI Applications 489 CGI Helper Routines 489 Developing CGI Scripts 498 Security Issues 4 The Kepler Project 498 CGI the Kepler Way 4 Lua Pages 500 Summary * 01 Exercises 501 Chapter 16: Connecting to a Larger World —503 Installing LuaSocket 503 Compiling LuaSocket 504 Compiling on Linux and Other Unix Like Systems 504 Compiling on Windows Installing Windows Binaries 505 Network Overview * 06 Routed Packets 506 Addresses ^07 Domain Names 507 Identifying Internet Resources 5 Transport Protocols 509 Sockets: Streams and Datagrams 51° TCP Socket Sociolo^v K1 Using LuaSocket for Network Communication 512 Handling Multiple Persistent Connections 518 Using Lua Coroutines with the select Function 518 Multiple Connections on the Server Side 522 Setting Timeout Values for the Server Socket 523 The Application Protocols 524 Filtering the Flow of Data 524 Accessing Web Pages 527 Sending and Receiving E mail Messages 529 Networking with Lua and Streams 536 On the Server Side: inetd and Friends 536 On the Client Side: ssh and Friends 538 Summary 541 Exercises 542 Chapter 17: Programming Games with Lua 543 Understanding Why and When to Use Lua 543 Simple 2 D Action Game Using SDL 544 Installing SDL and LuaCheia 544 Using SDL 546 Summary 562 Exercise 562 Chapter 18: Carrying Lua with You 5j 5_ Getting Started with Plua 565 Obtaining Plua 566 Examining the Distribution Contents 566 Exploring Plua s Features 567 Running the Plua Application 567 Saving Plua Programs 569 Reading the Online Documentation 570 Using Palm OS Streams 571 Compiling Applications 572 Compiling Libraries 573 Plua on the Mothership 576 The Command Line Compiler 576 The Palm OS Emulator 577 Obtaining the Emulator 577 Installing on Windows 578 Configuring POSE 578 Running Plua in the Emulator 578 Compiling a Program in the Emulator 580 Exiting the Emulator 580 The Palm OS Simulator 581 Obtaining the Simulator 581 Using the Simulator 581 Programming with Plua 581 Generating Graphics 582 Programming the User Interface 583 Accessing Databases 590 Summary 592 Exercises 593 Chapter 19: Fitting into the Lua Community 595 The Lua Web Site 596 The Lua Reference Manual 596 Framing Questions 597 The Lua Mailing List 597 Viewing and Searching the Archives 597 Downloading the Archives 598 Using a Web Browser to Access the List 599 Using a Newsreader to Access the List 599 Subscribing to the List Server 599 Posting Messages 600 The Lua Chat Room 601 Forums 601 The Lua Wiki 601 LuaForge 602 Annual Workshops 603 Summary 603 Appendix A: Answers 6Q5 Index 629
any_adam_object 1
author Jung, Kurt
author_facet Jung, Kurt
author_role aut
author_sort Jung, Kurt
author_variant k j kj
building Verbundindex
bvnumber BV023046267
callnumber-first Q - Science
callnumber-label QA76
callnumber-raw QA76.73.L82
callnumber-search QA76.73.L82
callnumber-sort QA 276.73 L82
callnumber-subject QA - Mathematics
classification_rvk ST 250
classification_tum DAT 364f
ctrlnum (OCoLC)72868224
(DE-599)BVBBV023046267
dewey-full 005.13/3
dewey-hundreds 000 - Computer science, information, general works
dewey-ones 005 - Computer programming, programs, data, security
dewey-raw 005.13/3
dewey-search 005.13/3
dewey-sort 15.13 13
dewey-tens 000 - Computer science, information, general works
discipline Informatik
format Book
fullrecord <?xml version="1.0" encoding="UTF-8"?><collection xmlns="http://www.loc.gov/MARC21/slim"><record><leader>01353nam a2200385zc 4500</leader><controlfield tag="001">BV023046267</controlfield><controlfield tag="003">DE-604</controlfield><controlfield tag="005">20111117 </controlfield><controlfield tag="007">t|</controlfield><controlfield tag="008">071212s2007 xxu |||| 00||| eng d</controlfield><datafield tag="020" ind1=" " ind2=" "><subfield code="a">0470069171</subfield><subfield code="9">0-470-06917-1</subfield></datafield><datafield tag="020" ind1=" " ind2=" "><subfield code="a">9780470069172</subfield><subfield code="c">(pbk) : £25.99</subfield><subfield code="9">978-0-470-06917-2</subfield></datafield><datafield tag="035" ind1=" " ind2=" "><subfield code="a">(OCoLC)72868224</subfield></datafield><datafield tag="035" ind1=" " ind2=" "><subfield code="a">(DE-599)BVBBV023046267</subfield></datafield><datafield tag="040" ind1=" " ind2=" "><subfield code="a">DE-604</subfield><subfield code="b">ger</subfield><subfield code="e">aacr</subfield></datafield><datafield tag="041" ind1="0" ind2=" "><subfield code="a">eng</subfield></datafield><datafield tag="044" ind1=" " ind2=" "><subfield code="a">xxu</subfield><subfield code="c">US</subfield></datafield><datafield tag="049" ind1=" " ind2=" "><subfield code="a">DE-1051</subfield><subfield code="a">DE-M347</subfield><subfield code="a">DE-91G</subfield></datafield><datafield tag="050" ind1=" " ind2="0"><subfield code="a">QA76.73.L82</subfield></datafield><datafield tag="082" ind1="0" ind2=" "><subfield code="a">005.13/3</subfield></datafield><datafield tag="084" ind1=" " ind2=" "><subfield code="a">ST 250</subfield><subfield code="0">(DE-625)143626:</subfield><subfield code="2">rvk</subfield></datafield><datafield tag="084" ind1=" " ind2=" "><subfield code="a">DAT 364f</subfield><subfield code="2">stub</subfield></datafield><datafield tag="100" ind1="1" ind2=" "><subfield code="a">Jung, Kurt</subfield><subfield code="e">Verfasser</subfield><subfield code="4">aut</subfield></datafield><datafield tag="245" ind1="1" ind2="0"><subfield code="a">Beginning Lua programming</subfield><subfield code="c">Kurt Jung and Aaron Brown</subfield></datafield><datafield tag="264" ind1=" " ind2="1"><subfield code="a">Indianapolis, Ind.</subfield><subfield code="b">Wiley,</subfield><subfield code="c">2007</subfield></datafield><datafield tag="300" ind1=" " ind2=" "><subfield code="a">XXVIII, 644 S.</subfield></datafield><datafield tag="336" ind1=" " ind2=" "><subfield code="b">txt</subfield><subfield code="2">rdacontent</subfield></datafield><datafield tag="337" ind1=" " ind2=" "><subfield code="b">n</subfield><subfield code="2">rdamedia</subfield></datafield><datafield tag="338" ind1=" " ind2=" "><subfield code="b">nc</subfield><subfield code="2">rdacarrier</subfield></datafield><datafield tag="490" ind1="0" ind2=" "><subfield code="a">Programmer to programmer</subfield></datafield><datafield tag="650" ind1=" " ind2="7"><subfield code="a">Lua &lt;Programmiersprache&gt;</subfield><subfield code="2">swd</subfield></datafield><datafield tag="650" ind1=" " ind2="4"><subfield code="a">Lua (Computer program language)</subfield></datafield><datafield tag="700" ind1="1" ind2=" "><subfield code="a">Brown, Aaron</subfield><subfield code="e">Sonstige</subfield><subfield code="4">oth</subfield></datafield><datafield tag="856" ind1="4" ind2="2"><subfield code="m">HBZ Datenaustausch</subfield><subfield code="q">application/pdf</subfield><subfield code="u">http://bvbr.bib-bvb.de:8991/F?func=service&amp;doc_library=BVB01&amp;local_base=BVB01&amp;doc_number=016249722&amp;sequence=000002&amp;line_number=0001&amp;func_code=DB_RECORDS&amp;service_type=MEDIA</subfield><subfield code="3">Inhaltsverzeichnis</subfield></datafield><datafield tag="943" ind1="1" ind2=" "><subfield code="a">oai:aleph.bib-bvb.de:BVB01-016249722</subfield></datafield></record></collection>
id DE-604.BV023046267
illustrated Not Illustrated
indexdate 2024-12-23T20:44:28Z
institution BVB
isbn 0470069171
9780470069172
language English
oai_aleph_id oai:aleph.bib-bvb.de:BVB01-016249722
oclc_num 72868224
open_access_boolean
owner DE-1051
DE-M347
DE-91G
DE-BY-TUM
owner_facet DE-1051
DE-M347
DE-91G
DE-BY-TUM
physical XXVIII, 644 S.
publishDate 2007
publishDateSearch 2007
publishDateSort 2007
publisher Wiley,
record_format marc
series2 Programmer to programmer
spellingShingle Jung, Kurt
Beginning Lua programming
Lua <Programmiersprache> swd
Lua (Computer program language)
title Beginning Lua programming
title_auth Beginning Lua programming
title_exact_search Beginning Lua programming
title_full Beginning Lua programming Kurt Jung and Aaron Brown
title_fullStr Beginning Lua programming Kurt Jung and Aaron Brown
title_full_unstemmed Beginning Lua programming Kurt Jung and Aaron Brown
title_short Beginning Lua programming
title_sort beginning lua programming
topic Lua <Programmiersprache> swd
Lua (Computer program language)
topic_facet Lua <Programmiersprache>
Lua (Computer program language)
url http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=016249722&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA
work_keys_str_mv AT jungkurt beginningluaprogramming
AT brownaaron beginningluaprogramming