Coder Social home page Coder Social logo

master3395 / roblox-plugin-template Goto Github PK

View Code? Open in Web Editor NEW

This project forked from anaminus/roblox-plugin-template

0.0 1.0 0.0 112 KB

This repo serves as a template for creating *large* Roblox plugins. That is, plugins so big that they need to be managed with multiple files.

roblox-plugin-template's Introduction

Roblox Plugin Project Template

This repo serves as a template for creating large Roblox plugins. That is, plugins so big that they need to be managed with multiple files.

Included is the source folder, containing example files, an example makeplugin.lua file, and a BUILD.md file, containing generalized instructions for building the project.

plugin.lua

plugin.lua combines together multiple Lua files (and other files) to make a Roblox plugin.

plugin.lua attempts to run a makefile. This is a file used to determine how the source files will be combined. It also defines extra information about the plugin.

plugin.lua can be run with the following arguments, all of which are optional:

lua plugin.lua [file] [-p]

  • file

    Specifies the location of the makefile. If unspecified, then this program attempts to open "makeplugin.lua" in the current directory.

  • -p

    Indicates that the program should attempt to automatically output the plugin to Roblox's plugin folder. This involves finding and parsing Roblox's settings file.

In order to make the plugin successfully, folders may need to be created, something which Lua cannot do normally. So, plugin.lua attempts to figure out what type of operating system it's running on, so that it knows how to create folders. It should be able to detect Windows and (hopefully) Unix systems. If plugin.lua cannot figure out what OS it's running on, then the required folders will have to be created manually.

The Makefile

The makefile is run in an environment that has access to the regular global variables, as well as the following variables:

  • META

    A table containing information about the plugin. Only one field is absolutely required:

    • META.PLUGIN_NAME

      A string indicating the name of the plugin. This value is used as the name of the plugin's folder.

  • read ( string path )

    Appends the file at path to the current file. Files are appended in the order they are called. path is in relation to the source folder (so "foo.lua" becomes "source/foo.lua").

    path may also be a table, in which case, each field in the table is appended as a global variable in a Lua file. Only fields that are valid variable names can be added.

  • write ( string path )

    Outputs the current file to path. path is in relation to the plugin folder ("foobar.lua" becomes "build/[PLUGIN_NAME]/foobar.lua").

    Also resets the current file, such that read may be called once again, to create a different file.

  • bwrite ( string path )

    Similar to write, but files are read and written in binary mode.

Here's an example makefile:

META.PLUGIN_NAME = "Foobar"
META.PLUGIN_VERSION = "1.0"
-- create foolbar.lua
read ( META ) -- append META table
read [[foo.lua]] -- append source/foo.lua
read [[bar.lua]] -- append source/bar.lua
write [[foobar.lua]] -- write to build/Foobar/foobar.lua
-- create icon.png
read [[images/icon.png]] -- append source/images/icon.png
bwrite [[icon.png]] -- write to build/Foobar/icon.png

roblox-plugin-template's People

Watchers

James Cloos 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.