Lublox: An object-oriented lua wrapper for the Roblox Web API

Lublox

An object-oriented lua wrapper for the Roblox Web API.
Github | Documentation | Discord

Recently I wanted to make a discord bot, to automate some processes in groups. I personally don’t like using Python, and Javascript just has a few little things that pushed me away from it, so I came back to what I know: Lua.

Luvit is very similar to node.js, but for lua. It has a good discord library, but no good roblox library. So I made one myself.

Lublox is an object-oriented roblox webapi library for luvit. Unlike most other object oriented libraries, Lublox doesn’t make a request every time a new object is created, instead it waits for you to call a function that gets the data, or until you index the data.

Installation

  1. Luvit

You first need to install luvit. Follow the instructions for your platform.

  1. Install the Library

After installing luvit, you need to install the library. Create a folder for your project and run

lit install Uncontained0/Lublox

This will install the library and all dependences.

Basic Examples

Get the followers of a user.

local Lublox = require("Lublox")
local Client = Lublox.Client()

local User = Client:User("Roblox") -- You can get a user by username or userid
local Pages = User.Followers

while not Pages.LastPage do
    for _,v in ipairs(Pages:Next()) do
        print(v.Name) -- v is a user object
    end
end

Get the roles in a group.

local Lublox = require("Lublox")
local Client = Lublox.Client()

local Group = Client:Group(1) -- you can only get group by groupid
for _,v in ipairs(Group.Roles) do
    print(v.Name)
end

Change a user’s rank in a group.

local Lublox = require("Lublox")
local Client = Lublox.Client()
Client:Authenticate(".ROBLOSECURITY")

local Group = Client:Group(1)
local Member Client:GetMember(1)

-- get the role of the rank, you cannot just set a rank, you must set to a role
local Role
for _,v in ipairs(Group.Roles) do
    if v.Rank == 100 then
        Role = v
        break
    end
end

Member:SetRole(Role)

Conclusion & Help

Thanks for reading, if you have any issues or find any bugs, let me know at my discord. Feel free to give feature suggestions or open pull requests/issues.

13 Likes

Was this wrapper deleted?

The repository and documentation link was invalid.

Sorry about that, the discord has been deleted but the repo and documentation are now back. I made this a while ago, and plan to release v2 when open cloud matures.

If you have any questions you can reach me at Uncontained#0729 on discord.

1 Like