mirror of
https://github.com/google/blockly.git
synced 2026-01-04 15:40:08 +01:00
Adds option to generate code for a single block
This commit is contained in:
@@ -162,10 +162,11 @@ Blockly.Lua.quote_ = function(string) {
|
||||
* Calls any statements following this block.
|
||||
* @param {!Blockly.Block} block The current block.
|
||||
* @param {string} code The Lua code created for this block.
|
||||
* @param {boolean} opt_thisOnly True to generate code for only this block.
|
||||
* @return {string} Lua code with comments and subsequent blocks added.
|
||||
* @private
|
||||
*/
|
||||
Blockly.Lua.scrub_ = function(block, code) {
|
||||
Blockly.Lua.scrub_ = function(block, code, opt_thisOnly) {
|
||||
var commentCode = '';
|
||||
// Only collect comments for blocks that aren't inline.
|
||||
if (!block.outputConnection || !block.outputConnection.targetConnection) {
|
||||
@@ -190,6 +191,6 @@ Blockly.Lua.scrub_ = function(block, code) {
|
||||
}
|
||||
}
|
||||
var nextBlock = block.nextConnection && block.nextConnection.targetBlock();
|
||||
var nextCode = Blockly.Lua.blockToCode(nextBlock);
|
||||
var nextCode = opt_thisOnly ? "" : Blockly.Lua.blockToCode(nextBlock);
|
||||
return commentCode + code + nextCode;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user