Questions about this topic? Sign up to ask in the talk tab.

Difference between revisions of "LUA"

From NetSec
Jump to: navigation, search
Line 1: Line 1:
 
Lua is a portable [[interpreted languages|interpreted language]]. It is mainly used in Games, however it is also used by [[nmap|NMAP]]'s Scripting Engine
 
Lua is a portable [[interpreted languages|interpreted language]]. It is mainly used in Games, however it is also used by [[nmap|NMAP]]'s Scripting Engine
  
 +
=Comments=
 +
{{code|text=
 +
<source lang="lua">
 +
-- This is a single line comment
 +
</source>
 +
}}
 +
{{code|text=
 +
<source lang="lua">
 +
--[[
 +
  This
 +
  is
 +
  a
 +
  multi-line
 +
  comment
 +
  ]]
 +
</source>
 +
}}
  
  
Line 7: Line 24:
 
{{code|text=
 
{{code|text=
 
<source lang="lua">
 
<source lang="lua">
Var = 0
+
Var = 1
 +
Var2 = "Im a var!"
 +
Var3 = 2
 +
Var4 = Var * Var3
 +
 
 
</source>
 
</source>
 
}}
 
}}

Revision as of 20:46, 4 May 2012

Lua is a portable interpreted language. It is mainly used in Games, however it is also used by NMAP's Scripting Engine

Comments

 
-- This is a single line comment
 
 
--[[
  This
  is
  a
  multi-line
  comment
  ]]
 


Variables

In Lua, variables are very simple, you don't even have to declare a datatype, all you need to do is assign a value.

 
Var = 1
Var2 = "Im a var!"
Var3 = 2
Var4 = Var * Var3
 
 

Global Variables vs Local Variables

When you declare a variable in Lua, it is globally accessible unless otherwise specified with local.

 
GlobalVar = 0
 


 
local LocalVar = 0
 
LUA is part of a series on programming.
<center>
</center>