Giter Site home page Giter Site logo

roliday-rumble's Introduction

roliday rumble

cute lil punchy game made for roliday 2019 :)

style guide

We follow Roblox's Lua style guide, with the following exceptions and additions:

naming

Use PascalCase for all filenames. This is so our file structure in-game matches Roblox's PascalCase naming convention.

When naming variables, use PascalCase for anything that comes from outside of the script. This allows us to differentiate at a glance what belongs to the module, and what comes from elsewhere:

-- good
local Players = game:GetService("Players")
local CollectionService = game:GetService("CollectionService")

local Messages = import "Utils/Messages"
local Foo = import "Shared/Foo"
local Baz = import("Shared/Bar", { "baz" })

-- bad
local players = game:GetService("Players")
local collectionService = game:GetService("CollectionService")

local messages = import "Utils/Messages"
local foo = import "Shared/Foo"
local baz = import("Shared/Bar", { "baz" })

Where this convention is broken:

  • The import function. This breaks convention because it's essentially treated as a global like print() or wait().
  • The t library, just because as a single letter, it carries meaning. T is strange to read and use.

imports

The import requirement should be at the top of the file, followed by services, module imports, etc.

-- good
local import = require(game.ReplicatedStorage.Shared.Import)

local Players = game:GetService("Players")

local foo = import "Shared/Foo"

-- bad
local Players = game:GetService("Players")

local import = require(game.ReplicatedStorage.Shared.Import)
local foo = import "Shared/Foo"

The block of import statements should be ordered by:

  1. Libraries, such as Roact and Rodux.
  2. Absolute paths.
  3. Relative paths.

In each category, organize imports based off alphabetical order, using the path.

-- good
local Roact = import "Roact"
local Foo = import "Shared/Foo"
local Bar = import "../Bar"

-- bad
local Bar = import "../Bar"
local Roact = import "Roact"
local Foo = import "Shared/Foo"

Use the export selection syntax when importing members of a module individually.

-- good
local Foo, Bar = import("Shared/Module", { "foo", "bar" })

-- bad
local Module = import "Shared/Module"
local Foo = module.foo
local Bar = module.bar

conditionals

Break up complicated if statements into multiple values.

-- good
local isThingType = thing == Constants.ThingType
local isBigEnough = Baby.BabyProp > 91
local notHogShit = thing ~= hogShit
if isThingType and isBigEnough and notHogShit then

-- bad
if (thing == Constants.ThingType) and (Baby.BabyProp > 91) and not hogShit then

roliday-rumble's People

Contributors

crossstarcross avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.