Code Monkey home page Code Monkey logo

apiswithlua's Introduction

Creating Solid APIs with Lua

Lua and C code examples that illustrate C/Lua integration.

These code samples were written as companions to the O'Reilly book Creating Solid APIs with Lua. The samples are built up chapter-by-chapter, and focus on a particular game called EatyGuy, which looks like this:

This game is text-based in order to enable simple graphics that work across platforms yet don't require any libraries. The code has runs on macOS, Ubuntu, and Windows.

Run make from the root repo directory to build all the examples. The built products are created in each chapter's directory (ch1, ch2, and so on). The game examples can be run by, for example, in ch6, typing the command ./eatyguy10 (each chapter has its own version of the game). Use the arrow keys to move your character around, and press q to quit.

Many more details are provided in the book! :)

Table of Contents

This section outlines the flow of content across the chapters of the book and corresponding subdirectories of this repo. Many of these topics center on learning Lua's C API.

  • Chapter 1 Running a Lua Script from C

    This chapter covers acquiring Lua's source as well as running Lua scripts from C.

  • Chapter 2 Calling C from Lua

    Writing C functions that Lua can call.

  • Chapter 3 Using Lua Values in C

    Manipulating Lua primitives and tables from C.

  • Chapter 4 Making Your API Classy

    A review of Lua classes, and how C works with Lua's userdata type to make safe, class-like objects in Lua.

  • Chapter 5 Detecting Errors

    Working with Lua errors (similar to exceptions) from C; making it easier to notice certain common mistakes.

  • Chapter 6 Sandboxing User Scripts

    Limiting the API and resource access of user scripts, including fine-grained constraints on CPU and memory consumption.

apiswithlua's People

Contributors

tylerneylon avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.