CMIContent Marketing InstituteContent directory

News · General · Archive

CodeMirror: Lua mode

Home News

.CodeMirror {border: 1px solid black;}

CodeMirror

Home Manual Code

Language modes Lua

Lua mode

--[[ example useless code to show lua syntax highlighting this is multiline comment ]]

function blahblahblah(x)

local table = { "asd" = 123, "x" = 0.34, } if x ~= 3 then print( x ) elseif x == "string" my_custom_function( 0x34 ) else unknown_function( "some string" ) end

--single line comment

end

function blablabla3()

for k,v in ipairs( table ) do --abcde.. y=[=[ x=[[ x is a multi line string ]] but its definition is iside a highest level string! ]=] print(" \"\" ")

s = math.sin( x ) end

end

var editor = CodeMirror.fromTextArea(document.getElementById("code"), { matchBrackets: true, theme: "neat" });

Loosely based on Franciszek Wawrzak's CodeMirror 1 mode . One configuration parameter is supported, specials , to which you can provide an array of strings to have those identifiers highlighted with the lua-special style.

MIME types defined: text/x-lua .

More in Archive · More in General · More in News