Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Lua vs ROBLOX Lua?

Asked by 8 years ago

Are they the same thing?

2 answers

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
8 years ago

Right from Lua's "About" page:

Lua is a powerful, fast, lightweight, embeddable scripting language.

Lua is intended to be embedded and customized in another program. Lua does provide a standard REPL and interpreter, but this is essentially just embedding the Lua API in a very simple C program.


Libraries

ROBLOX has added and removed things from the standard library. For example, most of io and os has been removed (because it is unsafe for place code to modify either ROBLOX's servers or player's computers). They've also removed the debug library and a few other smaller functions.

ROBLOX has added everything to do with the game -- that includes the instance hierarchy, services, and all of the function and methods associated (:Clone(), :Destroy(), Instance.new).

They've also defined a bunch of their own datatypes like Color3, UDim2, BrickColor3, Vector2, CFrame, etc.

Functionality

The actual language of ROBLOX is the same as (a very slightly outdated) Lua 5.1.

There are a few small differences that I'm aware of:

  • loadstring behaves very differently, rejecting bytecode in ROBLOX, and only working if it has been enabled.

  • The __gc metamethod does not fire in ROBLOX

Events & Async

ROBLOX extensively uses coroutines to make events work. Behind this is an event-scheduler which automatically resumes and yields threads to handle different events. While for the most part this is essentially doable in pure Lua, one small change is that yielding on the main thread will let you resume (almost) immediately and get the time elapsed in that time.

Ad
Log in to vote
3
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
8 years ago

Roblox Lua is Lua 5.1 with a few tweaks.

They removed support to libraries that can interact with the computer outside of roblox (such as os, io, package, debug) as these could be used to implement exploits very easily.

They have also added their own custom built in libraries (such as CFrame, Vector3, UDim2) to increase the ease of use.

However, they are essentially the same.

Answer this question