"userdata" should have a _set metademothd working. That is a bug, ops, sorry!. This is most probably because since I introduced classes with "user data size" sq_setclassudsize(), userdata has become borderline obsolete as classes tend to be more efficient most of the time, so it hasn't been used much.
Anyway no its no excuse, it should still work.
this should fix it as you already figured it out
Code:
bool SQVM::Set(const SQObjectPtr &self,const SQObjectPtr &key,const SQObjectPtr &val,SQInteger selfidx)
{
switch(type(self)){
case OT_TABLE:
if(_table(self)->Set(key,val)) return true;
break;
case OT_INSTANCE:
if(_instance(self)->Set(key,val)) return true;
break;
case OT_ARRAY:
if(!sq_isnumeric(key)) { Raise_Error(_SC("indexing %s with %s"),GetTypeName(self),GetTypeName(key)); return false; }
if(!_array(self)->Set(tointeger(key),val)) {
Raise_IdxError(key);
return false;
}
return true;
case OT_USERDATA: break; //must fallback
default:
Raise_Error(_SC("trying to set '%s'"),GetTypeName(self));
return false;
}
switch(FallBackSet(self,key,val)) {
case FALLBACK_OK: return true; //okie
case FALLBACK_NO_MATCH: break; //keep falling back
case FALLBACK_ERROR: return false; // the metamethod failed
}
if(selfidx == 0) {
if(_table(_roottable)->Set(key,val))
return true;
}
Raise_IdxError(key);
return false;
}
ciao
Alberto
Follow me on Twitter
@squirrellang