# Define SciTE settings for Lua files.

file.patterns.lua=*.lua

filter.lua=Lua (lua)|$(file.patterns.lua)|

lexer.$(file.patterns.lua)=lua

word.chars.lua=$(chars.alpha)$(chars.numeric)_%
word.characters.$(file.patterns.lua)=$(chars.alpha)$(chars.numeric)_%

keywordclass.lua=and break do else elseif end false for function if \
in local nil not or repeat return then true until while
keywords.$(file.patterns.lua)=$(keywordclass.lua)

# Basic Functions
keywordclass2.lua=_VERSION assert collectgarbage dofile error gcinfo loadfile loadstring \
print tonumber tostring type unpack

#### Lua 4.0
# Basic Functions
keywordclass2.lua4=_ALERT _ERRORMESSAGE _INPUT _PROMPT _OUTPUT \
_STDERR _STDIN _STDOUT call dostring foreach foreachi getn globals newtype \
rawget rawset require sort tinsert tremove

# String Manipulation & Mathematical Functions
keywordclass3.lua4=abs acos asin atan atan2 ceil cos deg exp \
floor format frexp gsub ldexp log log10 max min mod rad random randomseed \
sin sqrt strbyte strchar strfind strlen strlower strrep strsub strupper tan

# Input and Output Facilities & System Facilities
keywordclass4.lua4=openfile closefile readfrom writeto appendto \
remove rename flush seek tmpfile tmpname read write \
clock date difftime execute exit getenv setlocale time

#### Lua 5.0
# Basic Functions
keywordclass2.lua5=_G getfenv getmetatable ipairs loadlib next pairs pcall \
rawegal rawget rawset require setfenv setmetatable xpcall \
string table math coroutine io os debug
# I put the library names here, so when highlighted standalone, they are probably variable name from Lua 4.0 times.

# String Manipulation, Table Manipulation, Mathematical Functions (string & table & math)
keywordclass3.lua5=string.byte string.char string.dump string.find string.len \
string.lower string.rep string.sub string.upper string.format string.gfind string.gsub \
table.concat table.foreach table.foreachi table.getn table.sort table.insert table.remove table.setn \
math.abs math.acos math.asin math.atan math.atan2 math.ceil math.cos math.deg math.exp \
math.floor math.frexp math.ldexp math.log math.log10 math.max math.min math.mod \
math.pi math.rad math.random math.randomseed math.sin math.sqrt math.tan

# Coroutine Manipulation, Input and Output Facilities, System Facilities (coroutine & io & os)
keywordclass4.lua5=coroutine.create coroutine.resume coroutine.status \
coroutine.wrap coroutine.yield \
io.close io.flush io.input io.lines io.open io.output io.read io.tmpfile io.type io.write \
io.stdin io.stdout io.stderr \
os.clock os.date os.difftime os.execute os.exit os.getenv os.remove os.rename \
os.setlocale os.time os.tmpname

# I keep keywords5, 6, 7 & 8 for other libraries
# To make the change from Lua 4 to Lua 5 as smooth as possible, I made these properties
# modular and flexible.
# If you use only Lua 4, you can remove the lua5 keywords.
# If you use only Lua 5, you can either remove the lua4 keywords, or put them
# in another property to highlight them in a warning/error style.
# If you still use both, you can keep them like below, or use separate styles.

keywords2.$(file.patterns.lua)=$(keywordclass2.lua) $(keywordclass2.lua4) $(keywordclass2.lua5)
keywords3.$(file.patterns.lua)=$(keywordclass3.lua4) $(keywordclass3.lua5)
keywords4.$(file.patterns.lua)=$(keywordclass4.lua4) $(keywordclass4.lua5)

#~ statement.indent.$(file.patterns.lua)=5 do else function then
#~ statement.end.$(file.patterns.lua)=5 end until
#~ statement.lookback.$(file.patterns.lua)=20
indent.maintain.$(file.patterns.lua)=1

comment.block.lua=--~
comment.block.at.line.start.lua=1

# Lua styles

#Default
style.lua.32=$(font.code.base),fore:#000000
# White space: Visible only in View Whitespace mode (or if it has a back colour)
style.lua.0=fore:#FF0000
# Block comment (Lua 5.0)
style.lua.1=$(colour.code.comment.box),$(font.code.comment.box),back:#D0F0F0,eolfilled
# Line comment
style.lua.2=$(colour.code.comment.line),$(font.code.comment.line)
# Doc comment -- Not used in Lua (yet?)
style.lua.3=$(colour.notused),$(font.notused)
# Number
style.lua.4=$(colour.number)
# Keyword
style.lua.5=$(colour.keyword)
# String
style.lua.6=$(colour.string)
# Character
style.lua.7=$(colour.char)
# Literal string
style.lua.8=$(colour.string),$(font.code.comment.box),back:#E0FFFF
# Preprocessor (obsolete in Lua 4.0 and up)
style.lua.9=$(colour.preproc)
# Operators
style.lua.10=$(colour.operator)
# Identifier (everything else...)
style.lua.11=
# End of line where string is not closed
style.lua.12=back:#E0C0E0,eolfilled
# Other keywords (bozo test colors :-)
style.lua.13=$(style.lua.5),back:#D0FFD0
style.lua.14=$(style.lua.5),back:#D0D0FF
style.lua.15=$(style.lua.5),back:#FFD0D0
style.lua.16=$(style.lua.5),back:#FFD0FF
style.lua.17=$(style.lua.5),back:#FFFFD0
style.lua.18=$(style.lua.5),back:#FFA0A0
style.lua.19=$(style.lua.5),back:#FFD0D0
# Braces are only matched in operator style
braces.lua.style=10

command.compile.*.lua=LuaC-5.0.exe -o "$(FileName).luc" "$(FileNameExt)"
# Lua 5.0
command.go.*.lua=Lua-5.0.exe "$(FileNameExt)"
# Lua 4.0
#command.go.*.lua=Lua-4.0.exe -c -f "$(FileNameExt)"
