Sasu Posted March 27, 2013 Share Posted March 27, 2013 Me explican como hacer un export? Y eso de return tambien. Muchas gracias. Link to comment
Castillo Posted March 27, 2013 Share Posted March 27, 2013 Es muy simple, en el meta.xml pones asi: function="tuFuncion" type="elTipoDeScript ( client o server )" /> Y luego para llamarla es asi: exports [ "nombreDelRecurso" ]:tuFuncion ( ) Return: http://www.lua.org/pil/4.4.html Link to comment
Sasu Posted March 27, 2013 Author Share Posted March 27, 2013 Y como paso argumentos como player, element, etc? Y me podes explicar un poco mejor el return? Link to comment
Castillo Posted March 27, 2013 Share Posted March 27, 2013 Los pasas igual que en cualquier funcion. Link to comment
Sasu Posted March 27, 2013 Author Share Posted March 27, 2013 Por ejemplo: function getPlayerGang ( player, gangName ) local gangName = getElementData ( player , "gang") end function exportedOtherScript(thePlayer) export.gang_system:getPlayerGang( thePlayer, "test") end Eso estaria bien? Link to comment
Castillo Posted March 27, 2013 Share Posted March 27, 2013 Si, pero te falta devolver el valor: function getPlayerGang ( player ) return getElementData ( player , "gang") end function exportedOtherScript ( thePlayer ) gang = export.gang_system:getPlayerGang ( thePlayer ) end Link to comment
Sasu Posted March 27, 2013 Author Share Posted March 27, 2013 Y si quiero que la funcion sea buscar a un gang x nombre (getGangFromName) como deberia agregar el segundo argumento? Link to comment
Sasu Posted March 27, 2013 Author Share Posted March 27, 2013 Ahh ok gracias. Cualquier cosa si nesecito ayuda posteo. Link to comment
Recommended Posts