# Learning Lua

## Introduction

* This Repo's most content is taken from `Programming in Lua 4th Ed. by Roberto Lerusalimschy of Lua.Org`

## Get Lua

* [Installation](#installation)
  * `wget https://www.lua.org/ftp/lua-5.4.7.tar.gz`
  * `tar zxf lua-5.4.7.tar.gz`
  * `cd lua-5.4.7`
  * `make all install`
* [Test Installation](#test-installation)

  ```lua
  $ lua -v
  Lua 5.4.7  Copyright (C) 1994-2024 Lua.org, PUC-Rio
  ```

  * Start Lua in interactive Mode like ipython or python by running `lua` on command line
    * To Exit Lua Interactive Mode use ctrl-D or os.exit()
  * To start an interactive session after running a lua script use eg. `lua -i basics-1.lua`. Helpful for Debugging

## Basics

* Running Chunks
  * Each piece of code that Lua executes, such as a file or a single line in interactive mode, is called a chunk.
    * Run chunks by starting lua in interactive mode directly with `lua`
    * Run chunks by `dofile("<filename>")` inside another lua script or in an interactive session
    * Run chunks by adding `#!/usr/bin/env lua` at the beginning of a lua script , the set executable bit for script via `chmod +x basics-1.lua` ,and run it with name of script eg `./basics-1.lua`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ncsham.in/learnluawithme/readme.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
