|
|
@@ -207,7 +207,13 @@ static SQInteger _blob__set(HSQUIRRELVM v)
|
|
|
static SQInteger _blob__get(HSQUIRRELVM v)
|
|
|
{
|
|
|
SETUP_BLOB(v);
|
|
|
- SQInteger idx;
|
|
|
+ SQInteger idx;
|
|
|
+ SQObjectType ptype = sq_gettype(v, 2);
|
|
|
+ if( !(ptype == OT_INTEGER || ptype == OT_FLOAT) ){
|
|
|
+ //allow call metatable methods indexed by strings
|
|
|
+ sq_reseterror(v);
|
|
|
+ return SQ_ERROR;
|
|
|
+ }
|
|
|
sq_getinteger(v,2,&idx);
|
|
|
if(idx < 0 || idx >= self->Len())
|
|
|
return sq_throwerror(v,_SC("index out of range"));
|
|
|
@@ -328,7 +334,7 @@ static SQRegFunction _blob_methods[] = {
|
|
|
_DECL_BLOB_FUNC(swap4,1,_SC("x")),
|
|
|
_DECL_BLOB_FUNC(memset,4,_SC("xiii")),
|
|
|
_DECL_BLOB_FUNC(_set,3,_SC("xnn")),
|
|
|
- _DECL_BLOB_FUNC(_get,2,_SC("xn")),
|
|
|
+ _DECL_BLOB_FUNC(_get,2,_SC("x n|s")), //allow call metatable methods indexed by strings
|
|
|
_DECL_BLOB_FUNC(_typeof,1,_SC("x")),
|
|
|
_DECL_BLOB_FUNC(_nexti,2,_SC("x")),
|
|
|
_DECL_BLOB_FUNC(_cloned,2,_SC("xx")),
|