-
Notifications
You must be signed in to change notification settings - Fork 1
Calling Functions
KabanFriends edited this page Nov 27, 2022
·
1 revision
To manually call lua functions in-game, use /Lua call <function name>
. (/call <function name>
for short)
Any functions that you call using the call command should have a CallContext as the first parameter. The context will let you get who called the function, and from which message block, if the command is executed in message blocks.
Example function that you can call using /Lua call myFunction
:
-- "context" is the CallContext when using /Lua call myFunction to call this function
function myFunction(context)
context.player.message("Hello World!")
if context.mbX ~= nil then --context.mbX (or Y/Z) is nil when you run the /Lua call command manually
context.player.message("This function was called from a message block!")
end
end