Help about Lua's local and global declarations

This page summarizes the projects mentioned and recommended in the original post on /r/lua

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • minetest_game

    Minetest Game - A lightweight and well-maintained base for modding [https://github.com/minetest/minetest/]

  • Consider the variables declared inside the function map.update_hud_flags() in https://github.com/minetest/minetest_game/blob/master/mods/map/init.lua: what does the word local do in those declarations? Could it be omitted?

  • pprint.lua

    yet another lua pretty printer

  • good question. A file is actually very much like a function: it can't accept arguments, but it can have a return statement (it's called a chunk instead of function according to the lua doc though). Usually people make modules as files that return a table with their functions, then that can be loaded with require (there's an example in this thread). I've also seen some small libraries that only contain one function, like pprint.lua: they way it works is that pprint.lua is like

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts