Jump to content

What's wrong?


Piorun

Recommended Posts

I have one, simple question: Why this code doesn't work? :

CLIENT (ucp_c.lua):

ucp = {} 
  
function ucp.showLoginBar() 
    if guiGetVisible(ucp.loginBar) == false then 
        guiSetVisible(ucp.loginBar, true) 
    else 
        guiSetVisible(ucp.loginBar, false) 
    end 
end 

 

META.XML (ucp):

<export function="ucp.showLoginBar" type="client" /> 

 

CLIENT (other.lua):

call(getResourceFromName("ucp"), "ucp.showLoginBar") 

and error:

failed to call 

Can anyone help?

Link to comment

You can't use functions this way. The exported functions must be simply defined as regular functions.

function showLoginBar() 
    if guiGetVisible(ucp.loginBar) == false then 
        guiSetVisible(ucp.loginBar, true) 
    else 
        guiSetVisible(ucp.loginBar, false) 
    end 
end 
  

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...