Skip to content

CallContext

KabanFriends edited this page Nov 27, 2022 · 1 revision

A CallContext is an object that contains the context of a function call using /Lua call command. Call contexts are always provided as the first parameter when you use /Lua call to call a function.

player : Player

  • The Player that called the function.

mbX : number

  • X coordinate of the message block location, if the /Lua call command was used in a message block.
  • Returns nil if the function was not called from a message block.

mbY : number

  • Y coordinate of the message block location, if the /Lua call command was used in a message block.
  • Returns nil if the function was not called from a message block.

mbZ : number

  • Z coordinate of the message block location, if the /Lua call command was used in a message block.
  • Returns nil if the function was not called from a message block.

Example

-- "context" is the CallContext when using /Lua call myFunction to call this function
function myFunction(context)
    context.player.message("Hello World!")
end