mirror of
https://github.com/CPunch/Cosmo.git
synced 2025-10-27 19:30:06 +00:00
Minor refactor, added vm.* library
- cosmoV_pushObj() has been added - cbaselib.h has been cleaned up a bit
This commit is contained in:
@@ -5,15 +5,30 @@
|
||||
|
||||
/* loads all of the base library, including:
|
||||
- base library ("print", "assert", "type", "pcall", "loadstring", etc.)
|
||||
- string library ("string.sub", "string.split", "string.find")
|
||||
- string library ("string.sub", "string.find", "string.split", "string.charAt")
|
||||
*/
|
||||
COSMO_API void cosmoB_loadLibrary(CState *state);
|
||||
|
||||
/* loads the base string library, including:
|
||||
- string.sub
|
||||
- stirng.find
|
||||
- string.split
|
||||
- string.charAt
|
||||
|
||||
The base proto object for strings is also set, allowing you to invoke the string.* api through string objects, eg.
|
||||
`"hello world":split(" ")` is equivalent to `string.split("hello world", " ")`
|
||||
*/
|
||||
COSMO_API void cosmoB_loadStrLib(CState *state);
|
||||
|
||||
/* sets the base proto of all objects to the debug proto which allows for
|
||||
- manipulation of the ProtoObject of objects through the '__proto' field
|
||||
|
||||
additionally, the vm.* library is loaded, including:
|
||||
- manually setting/grabbing base protos of any object (vm.baseProtos)
|
||||
|
||||
for this reason, it is recommended to NOT load this library in production
|
||||
*/
|
||||
COSMO_API void cosmoB_loadDebug(CState *state);
|
||||
COSMO_API int cosmoB_print(CState *state, int nargs, CValue *args);
|
||||
COSMO_API int cosmoB_assert(CState *state, int nargs, CValue *args);
|
||||
COSMO_API int cosmoB_type(CState *state, int nargs, CValue *args);
|
||||
COSMO_API int cosmoB_pcall(CState *state, int nargs, CValue *args);
|
||||
|
||||
#define cosmoV_typeError(state, name, expectedTypes, formatStr, ...) \
|
||||
cosmoV_error(state, name " expected (" expectedTypes "), got (" formatStr ")!", __VA_ARGS__);
|
||||
|
||||
Reference in New Issue
Block a user