Results 1 to 5 of 5

Thread: Is it possible to call a function declared in Global inside an objects script?

  1. #1
    Join Date
    Mar 2016
    Location
    Brazil
    Posts
    16

    Is it possible to call a function declared in Global inside an objects script?

    I have several objects that need to use a function and it's a pain to copy the declaration to every object file.
    Last edited by JotaFaD; 01-18-2017 at 06:54 PM.

  2. #2
    callLuaFunctionInOtherScript(Global, "function_name")
    callLuaFunctionInOtherScriptWithParams(Global, "function_name", {var1, var2, var3})

  3. #3
    Join Date
    May 2016
    Posts
    1,072
    Alternatively:

    Global.call("function_name")
    Global.call("function_name", {var1, var2, var3}

    I'm not sure if either of our methods is depreciated

  4. #4
    Join Date
    Jan 2014
    Posts
    998
    callLuaFunctionInOtherScript() is deprecated use the call way MrStump said.

  5. #5
    Join Date
    Mar 2016
    Location
    Brazil
    Posts
    16
    Thanks everyone for the answers. Global.call(...) worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •