mirror of
https://github.com/google/blockly.git
synced 2026-01-11 19:07:08 +01:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user