User Tools

Site Tools


programming:lua

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
programming:lua [2021/04/02 06:42]
nanodano created
programming:lua [2021/04/14 02:44] (current)
nanodano [Executing code]
Line 13: Line 13:
 Also search for other packages with ''apt-cache search lua''  because there are a lot of libraries available like http, json, filesystem, curl, curses, databases and more. Also search for other packages with ''apt-cache search lua''  because there are a lot of libraries available like http, json, filesystem, curl, curses, databases and more.
  
-If you want to build from source, it's very easy because it's so portable and written in ANSI C. Simply [[https://www.lua.org/download.html|download], extract and run ''make''.+If you want to build from source, it's very easy because it's so portable and written in ANSI C. Simply [[https://www.lua.org/download.html|download]], extract and run ''make''.
  
 <code bash> <code bash>
Line 25: Line 25:
 </code> </code>
  
-===== Hello World =====+===== Executing code =====
  
-There are a few ways you could execute the Hello World code.+There are a few ways you could execute a script:
  
-In the interactive REPL: ''lua'' +  * In the interactive REPL: ''lua'' 
-By invoking the Lua interpreter and passing it a file: ''lua hello.lua'' +  By invoking the Lua interpreter and passing it a file: ''lua hello.lua'' 
-By executing a script directly with a shebang (''#!/usr/bin/lua'')''./hello'' +  By executing a script directly with a shebang (e.g. ''#!/usr/bin/lua''and run with ''./hello'' 
-Running a precompiled script (''luac hello.lua''): ''lua luac.out''+  Running a precompiled script. Compile with ''luac hello.lua'' and run with ''lua luac.out'' 
 + 
 +===== Hello World =====
  
 <code lua hello_world.lua> <code lua hello_world.lua>
 print 'hello world' print 'hello world'
 </code> </code>
programming/lua.1617345752.txt.gz · Last modified: 2021/04/02 06:42 by nanodano