int CLuaFunctionDefs::XMLSaveFile ( lua_State* luaVM )
{
    // CXMLNode*
    CXMLNode* pNode = NULL;
    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pNode );

    if ( !argStream.HasErrors ( ) )
    {
        if ( pNode )
        {
            CLuaMain * luaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
            if ( luaMain )
            {
                luaMain->SaveXML ( pNode );
                lua_pushboolean ( luaVM, true );
                return 1;
            }
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );

    lua_pushboolean ( luaVM, false );
    return 1;
}
Exemplo n.º 2
0
int CLuaXMLDefs::xmlSaveFile ( lua_State* luaVM )
{
    // CXMLNode*
    if ( lua_type ( luaVM, 1 ) != LUA_TLIGHTUSERDATA )
    {
        m_pScriptDebugging->LogBadType ( luaVM, "xmlSaveFile" );

        lua_pushboolean ( luaVM, false );
        return 1;
    }
    else
    {
        CXMLNode* pNode = lua_toxmlnode ( luaVM, 1 );
        if ( pNode )
        {
            CLuaMain * luaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
            if ( luaMain )
            {
                luaMain->SaveXML ( pNode );
                lua_pushboolean ( luaVM, true );
                return 1;
            }
        }
    }

    lua_pushboolean ( luaVM, false );
    return 1;
}