chore: import upstream snapshot with attribution
RequirementsTest / build (windows-latest, 3.9) (push) Has been cancelled
RequirementsTest / build (macos-latest, 3.9) (push) Has been cancelled
RequirementsTest / build (ubuntu-latest, 3.9) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Pylint / build (3.9) (push) Has been cancelled
RequirementsTest / build (windows-latest, 3.9) (push) Has been cancelled
RequirementsTest / build (macos-latest, 3.9) (push) Has been cancelled
RequirementsTest / build (ubuntu-latest, 3.9) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Pylint / build (3.9) (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2016 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Generating Lua for variable blocks.
|
||||
* @author rodrigoq@google.com (Rodrigo Queiro)
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.Lua.variables');
|
||||
|
||||
goog.require('Blockly.Lua');
|
||||
|
||||
|
||||
Blockly.Lua['variables_get'] = function(block) {
|
||||
// Variable getter.
|
||||
var code = Blockly.Lua.variableDB_.getName(block.getFieldValue('VAR'),
|
||||
Blockly.VARIABLE_CATEGORY_NAME);
|
||||
return [code, Blockly.Lua.ORDER_ATOMIC];
|
||||
};
|
||||
|
||||
Blockly.Lua['variables_set'] = function(block) {
|
||||
// Variable setter.
|
||||
var argument0 = Blockly.Lua.valueToCode(block, 'VALUE',
|
||||
Blockly.Lua.ORDER_NONE) || '0';
|
||||
var varName = Blockly.Lua.variableDB_.getName(
|
||||
block.getFieldValue('VAR'), Blockly.VARIABLE_CATEGORY_NAME);
|
||||
return varName + ' = ' + argument0 + '\n';
|
||||
};
|
||||
Reference in New Issue
Block a user