# Define SciTE settings for Lua files.

file.patterns.lua=*.lua

shbang.lua=lua

filter.lua=Lua (lua)|$(file.patterns.lua)|

lexer.$(file.patterns.lua)=lua

word.chars.lua=$(chars.alpha)$(chars.numeric)$(chars.accented)_%
word.characters.$(file.patterns.lua)=$(word.chars.lua)

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 (in both versions of Lua)
keywordclass2.lua=_VERSION assert collectgarbage dofile error gcinfo loadfile loadstring \
print rawget rawset require 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 \
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 \
rawequal setfenv setmetatable xpcall \
string table math coroutine io os debug \
load module select
# I put the library names here, so when highlighted standalone, they are probably variable name from Lua 4.0 times.
# Last line -> Lua 5.1 functions

# 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.pow math.rad math.random math.randomseed math.sin math.sqrt math.tan \
string.gmatch string.match string.reverse table.maxn \
math.cosh math.fmod math.modf math.sinh math.tanh math.huge
# Last 2 lines -> Lua 5.1 functions

# 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 \
coroutine.running package.cpath package.loaded package.loadlib package.path \
package.preload package.seeall io.popen
# Last 2 lines -> Lua 5.1 functions
# debug.debug debug.getfenv debug.gethook debug.getinfo debug.getlocal
# debug.getmetatable debug.getregistry debug.getupvalue debug.setfenv
# debug.sethook debug.setlocal debug.setmetatable debug.setupvalue debug.traceback

# 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.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)
# (Double quoted) String
style.lua.6=$(colour.string)
# Character (Single quoted string)
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, but toned down ;)
style.lua.13=$(style.lua.5),back:#F5FFF5
style.lua.14=$(style.lua.5),back:#F5F5FF
style.lua.15=$(style.lua.5),back:#FFF5F5
style.lua.16=$(style.lua.5),back:#FFF5FF
style.lua.17=$(style.lua.5),back:#FFFFF5
style.lua.18=$(style.lua.5),back:#FFA0A0
style.lua.19=$(style.lua.5),back:#FFF5F5
# Braces are only matched in operator style
braces.lua.style=10

# compatible with LuaBinaries for Lua 5.1; will work on both platforms.
command.compile.*.lua=luac5.1 -o "$(FileName).luc" "$(FileNameExt)"
# Lua 5.1
command.go.*.lua=lua5.1 "$(FileNameExt)"
# Lua 4.0
#command.go.*.lua=Lua-4.0.exe -c -f "$(FileNameExt)"
