-
Notifications
You must be signed in to change notification settings - Fork 16
Dataの命令ブロックをRubyに変換できるようにしました #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dataの命令ブロックをRubyに変換できるようにしました #74
Conversation
スクラッチ互換にするためには、ローカル変数は、スプライトのインスタンス変数として定義しないといけないのですよね。 つまり、 グローバル変数は、 |
リストの一番目が間違っていそう。 |
あと、CIが失敗しているので、eslint をパスしてないかも。 |
リストもグローバルではなくて、ローカル変数なので、 いや、正しくは、 |
リストや変数の定義は、 具体的には、 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
スクラッチ互換にするためには、ローカル変数は、スプライトのインスタンス変数として定義しないといけないのですよね。
つまり、
作った変数 = 0
は、
@作った変数 = 0
としてほしいです。グローバル変数は、
$作った変数 = 0
だね。
これに関しては、対処方法が見つかっていないため時間が掛かりそうです。
e404a6f
to
f9bee24
Compare
f9bee24
to
bf1a04b
Compare
ここには、ローカルかグローバルかの情報はなさそうですね。 |
これはあまりにもトリッキーなので、 ということで、以下の Blockly.Ruby.variableName(name) を index.js に定義して、それを呼び出すことにしてもらってもいいでしょうか? Blockly.Ruby.variableName = function (name, type = '') {
if (this.editingTarget.lookupVariableByNameAndType(name, type, false)) {
return `@#{name}`;
}
return `$#{name}`;
};
Blockly.Ruby.listName = function (name) {
return this.variableName(name, 'list');
}; |
調べて頂き誠にありがとうございました。 |
現状だと、Arrayを定義する文が書けないため違和感のあるコードになっていまいます。
どこかで、
リスト = Array.new
みたいなものがどこかで欲しいなとは思いました