index.html 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <!doctype html>
  2. <title>CodeMirror: Lua mode</title>
  3. <meta charset="utf-8"/>
  4. <link rel=stylesheet href="../../doc/docs.css">
  5. <link rel="stylesheet" href="../../lib/codemirror.css">
  6. <link rel="stylesheet" href="../../theme/neat.css">
  7. <script src="../../addon/edit/matchbrackets.js"></script>
  8. <script src="../../lib/codemirror.js"></script>
  9. <script src="lua.js"></script>
  10. <style>.CodeMirror {border: 1px solid black;}</style>
  11. <div id=nav>
  12. <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  13. <ul>
  14. <li><a href="../../index.html">Home</a>
  15. <li><a href="../../doc/manual.html">Manual</a>
  16. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  17. </ul>
  18. <ul>
  19. <li><a href="../index.html">Language modes</a>
  20. <li><a class=active href="#">Lua</a>
  21. </ul>
  22. </div>
  23. <article>
  24. <h2>Lua mode</h2>
  25. <form><textarea id="code" name="code">
  26. --[[
  27. example useless code to show lua syntax highlighting
  28. this is multiline comment
  29. ]]
  30. function blahblahblah(x)
  31. local table = {
  32. "asd" = 123,
  33. "x" = 0.34,
  34. }
  35. if x ~= 3 then
  36. print( x )
  37. elseif x == "string"
  38. my_custom_function( 0x34 )
  39. else
  40. unknown_function( "some string" )
  41. end
  42. --single line comment
  43. end
  44. function blablabla3()
  45. for k,v in ipairs( table ) do
  46. --abcde..
  47. y=[=[
  48. x=[[
  49. x is a multi line string
  50. ]]
  51. but its definition is iside a highest level string!
  52. ]=]
  53. print(" \"\" ")
  54. s = math.sin( x )
  55. end
  56. end
  57. </textarea></form>
  58. <script>
  59. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  60. matchBrackets: true,
  61. theme: "neat"
  62. });
  63. </script>
  64. <p>Loosely based on Franciszek
  65. Wawrzak's <a href="http://codemirror.net/1/contrib/lua">CodeMirror
  66. 1 mode</a>. One configuration parameter is
  67. supported, <code>specials</code>, to which you can provide an
  68. array of strings to have those identifiers highlighted with
  69. the <code>lua-special</code> style.</p>
  70. <p><strong>MIME types defined:</strong> <code>text/x-lua</code>.</p>
  71. </article>