Jump to content

xml and memo


Stevenn

Recommended Posts

well, I've got a problem i'm trying to set the memo text using a .xml file

local Rules = xmlLoadFile ( "xml/rules.xml" )  
local Ruless = xmlNodeGetValue ( Rules )  
  
window = guiCreateWindow(462,275,716,474,"",false) 
Rules = guiCreateButton(13,76,82,35,"Rules",false,window) 
memo = guiCreateMemo(117,29,582,386,"",false,window) 
  
function buttonClick(button) 
    if (button) ~= "left" then return end 
    if (source == Rules) then 
        guiSetText(memo, tostring(Ruless)) 
    end 
end 
addEventHandler("onClientGUIClick", resourceRoot, buttonClick, true) 

the file rules.xml inside the xml folder:

<Ruless> 
My rules here 
</Ruless> 

"Bad arguement at line: 2"

Link to comment
local rules = xmlLoadFile ( 'xml/rules.xml' ) 
  
window = guiCreateWindow(462,275,716,474,"",false) 
Rules = guiCreateButton(13,76,82,35,"Rules",false,window) 
memo = guiCreateMemo(117,29,582,386,"",false,window) 
  
addEventHandler ( 'onClientGUIClick', root, 
    function ( ) 
        if ( source == Rules ) then 
             guiSetText ( memo, tostring ( xmlNodeGetValue ( rules ) ) ) 
        end 
    end 
) 

Edited by Guest
Link to comment

-- script:

local Rules = xmlLoadFile ( "xml/rules.xml" ) 
local Ruless = xmlNodeGetValue ( Rules ) 
  
window = guiCreateWindow(462,275,716,474,"",false) 
Rules = guiCreateButton(13,76,82,35,"Rules",false,window) 
memo = guiCreateMemo(117,29,582,386,"",false,window) 
  
function buttonClick ( button ) 
    if ( button ~= "left" ) then  
        return  
    end 
     
    if ( source == Rules ) then 
        guiSetText ( memo, tostring ( Ruless ) ) 
    end 
end 
addEventHandler ( "onClientGUIClick", resourceRoot, buttonClick ) 

-- rules.xml

    My rules here 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...