Add a Lua code generator

This is based on the JS generator, with a lot of inspiration from Ellen
Spertus's blockly-lua: https://github.com/espertus/blockly-lua

All unit tests pass with Lua 5.3.2.
This commit is contained in:
Rodrigo Queiro
2016-02-04 16:54:52 +01:00
parent 0db36f3866
commit a5d3f340e5
19 changed files with 2090 additions and 2 deletions

View File

@@ -244,7 +244,7 @@ Code.LANG = Code.getLang();
* List of tab names.
* @private
*/
Code.TABS_ = ['blocks', 'javascript', 'php', 'python', 'dart', 'xml'];
Code.TABS_ = ['blocks', 'javascript', 'php', 'python', 'dart', 'lua', 'xml'];
Code.selected = 'blocks';
@@ -341,6 +341,14 @@ Code.renderContent = function() {
code = prettyPrintOne(code, 'dart');
content.innerHTML = code;
}
} else if (content.id == 'content_lua') {
code = Blockly.Lua.workspaceToCode(Code.workspace);
content.textContent = code;
if (typeof prettyPrintOne == 'function') {
code = content.innerHTML;
code = prettyPrintOne(code, 'lua');
content.innerHTML = code;
}
}
};