sgs_Parse*** [functions]
SGSBOOL sgs_ParseBool( sgs_Context* C, sgs_StkIdx item, sgs_Bool* out )
SGSBOOL sgs_ParseInt( sgs_Context* C, sgs_StkIdx item, sgs_Int* out )
SGSBOOL sgs_ParseReal( sgs_Context* C, sgs_StkIdx item, sgs_Real* out )
SGSBOOL sgs_ParseString( sgs_Context* C, sgs_StkIdx item, char** out, sgs_SizeVal* size )
SGSBOOL sgs_ParseObjectPtr( sgs_Context* C, sgs_StkIdx item, sgs_ObjInterface* iface, sgs_VarObj** out, int strict )
SGSBOOL sgs_ParsePtr( sgs_Context* C, sgs_StkIdx item, void** out )
Attempts to parse the specified item of the current stack frame, returning whether parsing was successful.
SGSBOOL sgs_ParseStringP( sgs_Context* C, sgs_Variable* var, char** out, sgs_SizeVal* size )
Attempts to parse the specified variable, returning whether parsing was successful.
- The parsing rules:
- for
sgs_ParsePtr
, unlike every other parsing function, only null/ptr types are considered valid;
- for
sgs_ParseObjectPtr
, only objects with the specified interface iface
are valid unless strict = 0, then null
is valid too;
- if
item
is out of bounds, fail;
- if item has the type
null
, func
or cfunc
, fail;
- if item is of
string
type and bool
is requested, fail;
- if item is of
string
type and int
/real
is requested, try to convert;
- everything else succeeds.