HowTo/Functions: Difference between revisions

no edit summary
No edit summary
 
No edit summary
Line 19: Line 19:


{{LuaCode|1=if debugMode then -- debugMode is a variable
{{LuaCode|1=if debugMode then -- debugMode is a variable
     outputChatBox('Debug mode is enabled for you!', COLOUR_GREEN)
     message('Debug mode is enabled for you!', COLOUR_GREEN)
end}}
end}}


'''Lua, Server-Side, Function:'''
'''Lua, Server-Side, Function:'''


{{LuaCode|1=outputChatBox('This message will be shown in the chat box!', COLOUR_GREEN) -- outputChatBox is a function}}
{{LuaCode|1=message('This message will be shown in the chat box!', COLOUR_GREEN) -- outputChatBox is a function}}


'''Lua, Server-Side, Property:'''
'''Lua, Server-Side, Property:'''


{{LuaCode|1=addEventHandler('onPlayerJoined', function(event,client)
{{LuaCode|1=addEventHandler('onPlayerJoined', function(event,client)
     outputChatBox(client.player.name .. ' has joined the server!', COLOUR_GREEN) -- name is a property of type Element (type Player inherits functionality of Element)
     message(client.player.name .. ' has joined the server!', COLOUR_GREEN) -- name is a property of type Element (type Player inherits functionality of Element)
end)}}
end)}}


6,833

edits