Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Indenting your code - Programming 101
- -- Indenting your code makes things more clear for people reading your code
- -- This indented code is much easier to understand
- if is_admin then
- if player_vehicle then
- destroyElement(player_vehicle)
- outputChatBox("Your vehicle has been destroyed", player)
- else
- outputChatBox("You are not in a vehicle", player)
- end
- end
- -- than this unindented code
- if is_admin then
- if player_vehicle then
- destroyElement(player_vehicle)
- outputChatBox("Your vehicle has been destroyed", player)
- else
- outputChatBox("You are not in a vehicle", player)
- end
- end
- -- Both bits do the following:
- -- If the user is an admin and in a vehicle, destroy the vehicle (and tell them this)
- -- If the user is an admin and in NOT a vehicle, tell them this
- -- BUT If the user is not an admin, don't do anything
- -- But the second snippet is BADLY indented!
- -- It looks like:
- -- If the user is an admin, destroy the vehicle and tell them this
- -- If the user is not an admin, tell them they are not in a vehicle
- -- When new "scopes" are created you should indent.
- -- When you use local variables those variables are only available in those scopes.
- -- New "scopes" are created when (this list in incomplete) you use:1
- -- "for .. do .. end",
- -- "repeat .. until ...",
- -- "while .. do ... end",
- -- "do .. end" etc
- -- Use the tab key (above caps lock on the left) to indent.
- -- Make sure you use Sublime Text or Notepad++ to edit your code.
- -- DO NOT use plain notepad.
Advertisement
Add Comment
Please, Sign In to add comment