Extern support for creating userdata collections
This commit is contained in:
parent
5b3bc26bdb
commit
8e64da15a0
|
@ -33,6 +33,11 @@ namespace Porygon::UserData {
|
|||
return make_shared<UserDataCollectionType>(nullptr, valueType, false, true);
|
||||
}
|
||||
|
||||
static UserDataCollectionType * CreateIterable(const ScriptType* valueType){
|
||||
return new UserDataCollectionType(nullptr, shared_ptr<const ScriptType>(valueType),
|
||||
false, true);
|
||||
}
|
||||
|
||||
bool CanBeIndexedWith(const ScriptType* indexer) const final{
|
||||
if (!_indexable){
|
||||
return false;
|
||||
|
|
|
@ -1 +1,15 @@
|
|||
#include "UserDataCollectionValue.hpp"
|
||||
|
||||
namespace Porygon::UserData{
|
||||
extern "C" {
|
||||
UserDataCollectionType* CreateCollectionType(const ScriptType* keyType, const ScriptType* valueType){
|
||||
return UserDataCollectionType::CreateIndexable(keyType, valueType);
|
||||
}
|
||||
UserDataCollectionValue* CreateCollectionValue(UserDataCollectionType* type, void* obj,
|
||||
const EvalValue* (*get)(void*, const EvalValue*),
|
||||
void (*set)(void*, const EvalValue*, const EvalValue*),
|
||||
Iterator* (*getIterator)(void*)){
|
||||
return new UserDataCollectionValue(type, new UserDataCollectionHelper(obj, get, set, getIterator));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue