Jump to content

Export functions: Issue with parameters


Overkillz

Recommended Posts

I'm having an issue while using exported functions with receive some parameters

Im trying to read the first parameter, but it doesn't work at all, it reads the second one.

What do I mean ?

-- CLIENT

local util = exports["SHI_Util"]

function whatever()
	util.isEmptyString("FIRST_PARAMETER", "SECOND_PARAMENTER")
end

-- SHARED CLASS
function isEmptyString(s)
    outputChatBox("Recived string: " ..s)
end

-- RESULT --> Recived string: SECOND_PARAMENTER

-- META.XML
<meta>
	<export function="isEmptyString" type="shared"/>
</meta>

Something similar happens with server side exported functions.

I hope you can bring me a hand with this. Thanks in advice, best regards.

 

 

Edited by Overkillz
Link to comment

Well, I've just realized about few things that I wasn't aware about them.

First of all, If you store your exported resource which containts your exported functions in a variable, you can't call those functions with: myVariable(dot)functionName

-- This doesn't work
util.isEmptyString("FIRST_PARAMETER", "SECOND_PARAMENTER")
--## RESULT: SECOND_PARAMENTER


-- Right way to read parameters
util:isEmptyString("FIRST_PARAMETER", "SECOND_PARAMENTER")
--## RESULT: FIRST_PARAMETER

Thats all, thanks for reading.

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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