mirror of
https://github.com/CPunch/Cosmo.git
synced 2024-12-23 06:40:03 +00:00
Added argument type check to string.len
This commit is contained in:
parent
27aedd2969
commit
44f1674b09
@ -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