2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-15 06:12:59 +00:00
cheat.sheets/sheets/lua

30 lines
999 B
Plaintext
Raw Normal View History

2017-06-02 12:29:36 +00:00
# lua
# Simple, extensible, embeddable programming language
# You may not have access to the `lua` command, but instead to something like
# `lua5.3` or one of a different version. The following information assumes you
# have the `lua` command, as-is, but alternative commands may also work the
# same or similarly, version allowing.
2017-06-02 12:29:36 +00:00
# Start an interactive Lua shell:
lua
# Execute a Lua script.
lua script_name.lua
# Execute a Lua script, with arguments (IE: flags) given to the script itself.
lua script_name.lua [ARGS]
2017-06-02 12:29:36 +00:00
# Execute a Lua expression(s), as though executed from within a script.
lua -e 'print("Hello World")'
2017-06-02 12:29:36 +00:00
# All options are handled in order, except `-i`. For instance, an invocation
# like first set a to 1, then print the value of a (1), and finally run the
# file `script.lua`
2017-06-02 12:29:36 +00:00
lua -e'a=1' -e 'print(a)' script.lua
# See also:
# Lua language cheat sheets at /lua/
# list of pages: /lua/:list
# learn lua: /lua/:learn
# search in pages: /lua/~keyword