Skip to content

Instantly share code, notes, and snippets.

@adrian-alberto
adrian-alberto / soop.lua
Created January 22, 2019 20:43
Simple OOP for Roblox
--[[
Classes are simple modules placed in the SoopHierarchy folder.
Methods, functions, and properties are handled the same as in standard metatable-
based oop frameworks.
Class hierarchy follows the hierarchy of module objects in the hierarchy folder.
Single-inheritence, default constructors(:init()), etc. are handled automatically on start.
--]]
local hierarchy = script.Parent.SoopHierarchy
Dict = {}
function Dict.__newindex(table, key, value)
if value ~= nil and table.__INNER[key] == nil then
table.__LENGTH = table.__LENGTH + 1
elseif value == nil and table.__INNER[key] ~= nil then
table.__LENGTH = table.__LENGTH - 1
end
rawget(table,"__INNER")[key] = value
end
@adrian-alberto
adrian-alberto / ErrorReportTrello.lua
Created July 25, 2015 00:56
Error Reports to Trello board from ROBLOX
--Don't forget to put a RemoteFunction called SubmitErrorFunction inside of this script object
--TRELLO
local HttpService = game:GetService("HttpService")
local httpEnabled = pcall(function() HttpService:GetAsync("http://httpbin.org/ip", true) end)
local TrelloAPI = {}
--GET THESE FROM TRELLO API
TrelloAPI.key = "KEY"
TrelloAPI.token = "TOKEN"
@adrian-alberto
adrian-alberto / oop.lua
Last active August 29, 2015 14:18
My custom OOP framework for Lua.
function class(inheritsFrom)
local c = {}
local c_mt = {__index = c, __tostring = function(obj) if obj.tostring then return obj:tostring() end end}
function c.new(...)
local obj = setmetatable({}, c_mt)
if obj.init then obj:init(...) end
return obj
end
function c.super()
return inheritsFrom
@adrian-alberto
adrian-alberto / <3.lua
Last active June 9, 2022 18:14
View with syntax highlighting.
false nil true true nil true nil false
nil nil then nil nil true else nil nil
true while local true if in local true
nil not or repeat return then else nil
nil until while and then do elseif nil
nil else elseif for return then in nil
true local else function break if true
false then while return then for false
nil nil do return for function nil nil
false nil function while not nil false