bool QtnPropertyDelegateFactory::registerDelegateDefault(const QMetaObject* propertyMetaObject, CreateFunction* createFunction, const QByteArray& delegateName)
{
    Q_ASSERT(propertyMetaObject);
    Q_ASSERT(createFunction);

    // find or create creation record
    CreateItem& createItem = m_createItems[propertyMetaObject->className()];
    // register default create function
    createItem.defaultCreateFunction = createFunction;

    if (!delegateName.isEmpty())
        return registerDelegate(propertyMetaObject, createFunction, delegateName);

    return true;
}
void NativeDelegate::setVM(lua_State *vm, bool newCallbacks)
{
    if (L)
    {
        if (newCallbacks)
        {
            createCallbacks();
        }
        return;
    }

    L = vm;

    registerDelegate(vm, this);

    // first time we're setting VM, so make sure callbacks table exists
    createCallbacks();
}