; ラッパーモジュール ; Variant.as #ifndef Variant #ifndef Varian […]
; ラッパーモジュール ; Variant.as #ifndef Variant #ifndef Varian […]
; ラッパーモジュール; Variant.as#ifndef Variant#ifndef VariantAliasOff#define global vDim dim@Variant#define global vAdd add@Variant#define global vSet set@Variant#define global vReSet reSet@Variant#define global vItem item@Variant#define global vRefItem refItem@Variant#define global vRemove remove@Variant#endif#module Variant thisItem#define global dim@Variant(%1) dimtype %1,5#define add(%1,%2)%t %i=%2:newmod %1,Variant,%o#modinit var _itemthisItem=_item: return#define set(%1,%2)%t %i=%2:__set@Variant %1,%o#modfunc local __set var _itemthisItem=_item: return#define reSet(%1,%2,%3) set@Variant %1,item@Variant(%1)%2%3#modcfunc local itemreturn thisItem#modfunc local refItem var _item_item=thisItem: return#define remove delmodreturn#global#endif;-----ここから別ファイル---------------------------------; testVariant.hsp#runtime "hsp3cl"#include "Variant.as"#module Program#deffunc mainvDim list1vAdd list1,"ナス"vAdd list1,50vAdd list1,1.586mes "【list1】"foreach list1mes vItem(list1(cnt))loopmes "【Index 1 changed】"vSet list1(1),256vReSet list1(2),*,2foreach list1mes vItem(list1(cnt))loopmes "【list2】"vDim list1vAdd list2,"キュウリ"vAdd list2,51vAdd list2,1.1024vAdd list2,*jumpingdim itemforeach list2vRefItem list2(cnt),itemif vartype(item)=vartype("label") {gosub item}else {mes item}loopmes "【Removed list2】"vRemove list2(1)vRemove list2(3)dim itemforeach list2vRefItem list2(cnt),itemif vartype(item)=vartype("label") {gosub item}else {mes item}loopreturn*jumpingmes "ラベルジャンピング!": return#globalmain