Jump to content

[BUG] Failed to call [string "?"]


DriFtyZ

Recommended Posts

Posted

Exact what the title says, i can't figure it out what is wrong with a simple exports code im testing, thanks!

error: Failed to call '[DWN]Core:showErrorCode'[string "?"]

code to call the function:
 

exports["[DWN]Core"]:showErrorCode(player, "02")

code of the exported function:

function showErrorCode (player, int)
	if player then
		if int == "02" then
			-- Some random code to excecute here
      		outputChatBox("It Works!")
		end
	end
end


 

  • Moderators
Posted

and the meta of the resource you are calling? (since you have to enable export functions there)

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

  • Moderators
Posted
call(getResourceFromName("[DWN]Core"), "showErrorCode", player, "02)

Try to use call instead. The exports function does not always work correctly, I haven't figured out the reason of that.

 

Btw it is not recommended to use special characters in your resources names. [DWN]Core

Those brackets are used to make folders invisible for the server. [invisible]

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted (edited)

The brackets wasn't a problem i tried it without them before, anyways ill try the "call" way and let you know

Edited by DriFtyZ

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