-
-
Notifications
You must be signed in to change notification settings - Fork 474
Description
Is your feature request related to a problem? Please describe.
Sometimes in scripting community i saw some people having issues with Lua oop which is not good at this moment.
Lua doesn't support inheritance, etc.... natively (these features are available with usage of 3rd party libraries)
now imagine we use that libs and create a bunch of classes/instances in our script , the memory usage won't be good as we need. and in real-world projects we actually need to use a bunch of classes to shorten our code and make it maintainable.
Describe the solution you'd like
Lua is good for simple/small projects but the problem myself seen in my 3~4 years of scripting Lua for mta is that the exception handling is boring and it has kinda bad/ugly syntax. now let's compare them for example.
Actually Lua is faster than squirrel, BUT squirrel is a high level programming language which supports so many thing's that Lua doesn't support natively
for example creating some class/instances in lua take so much more memory and CPU usage because of usage of 3rd party libs
in addition squirrel has a better performance in this case because of native support for them.
and squirrel has a nice syntax which isn't that hard for any Lua programmer to learn it. actually it can make our code more maintainable.
Squirrel
local something = {}; // This is a table, just like the ones in Lua
try {
// Do something that generates an error: mis-assign a new table slot
// Should be something .newSlot <- 1234
something .newSlot = 1234;
} catch(exception) {
logger.error("ERROR: the index 'newslot' does not exist");
// Displays "ERROR: the index 'newslot' does not exist" in the log
}
Lua
local ped = createPed(415, 0, 0, 0)
do
local response = setElementDimension(ped, -1)
if (response) then
print("Job is done")
else
print("Got a problem!")
end
end
Describe alternatives you've considered
Additional context
The squirrel language is and Open-source scripting language and it's best for IoT and/or embedded programming purposes
and the official repository for this language is https://github.com/albertodemichelis/squirrel
it's also usable in cpp programs which means it can also be used in mta-blue project too!