Jump to content

anchor

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by anchor

  1. It returns nil, as the comment that i've been written. and yes i think the problem is exports doesnt allow function to be passed.
  2. Hello all. I'm creating a function that the parameters are functions (or maybe it called callback? idk) What i'm going to do is creating a function that creates buttons and do some dxdraw, but with a handler, and exports the function so i can reuse it whenever i need it. The problem is the function is returning nil. I've read in another forums, it said " Lua functions are just values, and you can asssign them using their name without paren" Link But it doesnt work. Here the codes (I simplify it) local messages = {} function drawConfirmationButton( ) for k,message in ipairs( messages ) do if ( message[2] ) and ( message[3] ) then destroyElement( message[2] ) destroyElement( message[3] ) end message[2] = guiCreateButton(--[[blabla]]) message[3] = guiCreateButton(--[[blabla]]) addEventHandler( "onClientGUIClick", message[2], message[4] ) addEventHandler( "onClientGUIClick", message[3], message[5] ) end end function createConfirmations( m, onAccept, onReject ) -- i've been log the onAccept and onReject and it return nil table.insert( messages, { m, acceptButton, rejectButton, onAccept, onReject } ) addEventHandler( "onClientRender", root, drawConfirmation ) drawConfirmationButton() end Use it in another file. exports.common:createConfirmations( "Accept the request?", function() --[[code here]] end, function() --[[code here]] end ) Maybe some of you can help me or maybe another methods. Thanks for your attentions, sorry for my bad English
  3. it's gr8 m8! but i think, it's better to use gta sa map (like maddog mansion or anything) or your own map so the gamemode is bomb defusal but in gta sa form
×
×
  • Create New...