mirror of
https://github.com/CPunch/Cosmo.git
synced 2024-11-24 16:11:04 +00:00
Added argument type check to string.len
This commit is contained in:
parent
472a0ea4c1
commit
50b19e9f4f
@ -516,6 +516,11 @@ int cosmoB_sLen(CState *state, int nargs, CValue *args) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!IS_STRING(args[0])) {
|
||||
cosmoV_typeError(state, "string.len", "<string>", "%s", cosmoV_typeStr(args[0]));
|
||||
return 0;
|
||||
}
|
||||
|
||||
cosmoV_pushNumber(state, strlen(cosmoV_readCString(args[0])));
|
||||
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user