Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
2.0.2 修复临时变量可能返回函数的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bddjr committed Jul 4, 2023
1 parent bba09d6 commit 591c600
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
File renamed without changes.
15 changes: 11 additions & 4 deletions categorys/temp_var.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ module.exports = ( category_id )=>{ api.addBlocks([
}
},
//===========================================================
{//2.0.1
{//2.0.2
opcode: `${category_id}.get_value`,
messageId: `${category_id}.get_value`,
categoryId: category_id,
Expand All @@ -96,7 +96,10 @@ module.exports = ( category_id )=>{ api.addBlocks([
},
function: (args,util)=>{
try{
return vm.bddjr_toolbox_v2_temp_var?.[ args.name ];
if( vm.bddjr_toolbox_v2_temp_var?.hasOwnProperty( args.name ) ){
return vm.bddjr_toolbox_v2_temp_var[ args.name ];
}
//return undefined
}catch(e){
return my_log_block_error( util.currentBlock.id, util.currentBlock.opcode, e )
}
Expand Down Expand Up @@ -243,7 +246,7 @@ module.exports = ( category_id )=>{ api.addBlocks([
}
},
//===========================================================
{//2.0.1
{//2.0.2
opcode: `${category_id}.get_sprite_var_value`,
messageId: `${category_id}.get_sprite_var_value`,
categoryId: category_id,
Expand All @@ -267,7 +270,11 @@ module.exports = ( category_id )=>{ api.addBlocks([
},
function: (args,util)=>{
try{
return get_sprite_target( util, args.sprite_type, args.sprite_name ).bddjr_toolbox_v2_temp_var?.[ args.name ];
let tv = get_sprite_target( util, args.sprite_type, args.sprite_name ).bddjr_toolbox_v2_temp_var;
if( tv?.hasOwnProperty( args.name ) ){
return tv[ args.name ]
}
//return undefined
}catch(e){
return my_log_block_error( util.currentBlock.id, util.currentBlock.opcode, e )
}
Expand Down
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "bddjr.toolbox_v2",
"author": "bddjr",
"version": "2.0.1",
"version": "2.0.2",
"icon": "assets/icon.webp",
"inset_icon": "assets/inset_icon.webp",
"api": 1
Expand Down

0 comments on commit 591c600

Please sign in to comment.