Difference between revisions of "User:SuzannaLinn Resident/LuaHistory"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with "= History = Currently, we only have LSL, but soon we’ll have two options: LSL and Lua. There are two Lua-related projects in Second Life: * Lua server-side: This will al...")
 
Line 1: Line 1:
= History =
= Introducing Lua: The New Scripting Language for SL. =


Currently, we only have LSL, but soon we’ll have two options: LSL and Lua.
In these pages, I am compiling information about Lua and LuaSL to give you an overview of their features and functionalities.




There are two Lua-related projects in Second Life:
I have opened a topic in the community forums: [https://community.secondlife.com/forums/topic/516476-expecting-lua/ Expecting Lua]. If you have any additional information, questions, comments, opinions or anything else related to Lua in SL that comes to mind, please share them! :)


* Lua server-side: This will allow us to write scripts in Lua similarly to how we currently use LSL.


* Lua client-side: This will enable scripting within the viewer itself, allowing for customization and enhancements to improve the user experience.
I will begin a series of in-world classes on LuaSL as soon as it becomes available in the Beta Grid. These classes will be oriented to scripters who primarily use LSL, and they will cover not only Lua but also introduce new programming concepts that are currently absent in LSL.


Once Lua is launched on the Main Grid, I will repeat the same series of classes, allowing you to choose the moment to start your learning journey.


Server-side Lua will be available first, with client-side Lua coming later.
For advanced scripters who have a solid understanding of other programming languages and don't require detailed classes, I will host script meetings and Q&A sessions, to exchange ideas and ask questions.




== What is Lua? ==
If LSL is your main scripting language and you want to expand your programming skills beyond SL, learning Lua is a great next step. Lua introduces powerful features and modern programming concepts that will broaden your knowledge and make it easier to transition to modern, in-demand languages like C#, Python, and JavaScript.


Lua (pronounced LOO-ah) is a scripting language designed for embedding into other applications.


Its name means "Moon" in Portuguese. It was developed in Brazil in 1993.
== Lua index ==


It's designed focusing on speed and security, to be integrated into other applications and to be extensible adding new functions.
* [[User:SuzannaLinn_Resident/Lua_History | History]]
** [[User:SuzannaLinn_Resident/Lua_History#What_is_Lua.3F | What is Lua?]]
** [[User:SuzannaLinn_Resident/Lua_History#Why_Lua.3F | Why Lua?]]
** [[User:SuzannaLinn_Resident/Lua_History#Which_Lua.3F | Which Lua?]]




== Why Lua? ==
* [[User:SuzannaLinn_Resident/LuaLanguage1 | The language: Lua compared to LSL]]
** [[User:SuzannaLinn_Resident/LuaLanguage1#Types_and_variables | Types and variables]]
** [[User:SuzannaLinn_Resident/LuaLanguage1#Operators | Operators]]
** [[User:SuzannaLinn_Resident/LuaLanguage1#If.2C_while.2C_for.2C_repeat | If, while, for, repeat]]
** [[User:SuzannaLinn_Resident/LuaLanguage1#Functions.2C_ll_functions | Functions, ll functions]]
** [[User:SuzannaLinn_Resident/LuaLanguage1#Tables_as_lists | Tables as lists]]
** [[User:SuzannaLinn_Resident/LuaLanguage1#Tables_as_.28key.2C_value.29_pairs_.28like_the_linkset_data.29 | Tables as (key, value) pairs (like the linkset data)]]
** [[User:SuzannaLinn_Resident/LuaLanguage1#Tables_of_functions_instead_of_if...elseif_chain | Tables of functions instead of if...elseif chain]]
** [[User:SuzannaLinn_Resident/LuaLanguage1#Events_and_states | Events and states]]


Lindens have evaluated C#, Javascript, Python and Lua.


Perhaps we would have chosen one of the other three languages. And we had been hearing about C# for years and years... but... it's Lua.
* [[User:SuzannaLinn_Resident/LuaLanguage2 | The language: Lua beyond LSL]]
** [[User:SuzannaLinn_Resident/LuaLanguage2#Tables_as_lists_of_lists | Tables as lists of lists ]]
** [[User:SuzannaLinn_Resident/LuaLanguage2#Functions.2C_parameters_and_returns | Functions, parameters and returns ]]
** [[User:SuzannaLinn_Resident/LuaLanguage2#Functions.2C_anonymous_functions | Functions, anonymous functions ]]
** [[User:SuzannaLinn_Resident/LuaLanguage2#Sorting_dictionary_tables | Sorting dictionary tables ]]
** [[User:SuzannaLinn_Resident/LuaLanguage2#Closures | Closures ]]
** [[User:SuzannaLinn_Resident/LuaLanguage2#For_and_iterators | For and iterators ]]
** [[User:SuzannaLinn_Resident/LuaLanguage2#Metatables_and_metamethods | Metatables and metamethods ]]
** [[User:SuzannaLinn_Resident/LuaLanguage2#Objects | Objects ]]
** [[User:SuzannaLinn_Resident/LuaLanguage2#Objects_and_encapsulation | Objects and encapsulation ]]
** [[User:SuzannaLinn_Resident/LuaLanguage2#Objects_and_inheritance | Objects and inheritance ]]
** [[User:SuzannaLinn_Resident/LuaLanguage2#Objects_and_inheritance_with_functions_override | Objects and inheritance with functions override ]]
** [[User:SuzannaLinn_Resident/LuaLanguage2#Objects_and_abstract_classes | Objects and abstract classes ]]
** [[User:SuzannaLinn_Resident/LuaLanguage2#Objects_and_multiple_inheritance | Objects and multiple inheritance ]]
** [[User:SuzannaLinn_Resident/LuaLanguage2#Error_handling | Error handling ]]
** [[User:SuzannaLinn_Resident/LuaLanguage2#Libraries | Libraries ]]
** [[User:SuzannaLinn_Resident/LuaLanguage2#Modules_and_packages | Modules and packages ]]
** [[User:SuzannaLinn_Resident/LuaLanguage2#Debugging | Debugging ]]
** [[User:SuzannaLinn_Resident/LuaLanguage2#Co-routines | Co-routines ]]


Lua is much more powerful than LSL script, but less powerful than the others. Disappointing? I was... until I learned Lua and understood why.


* [[User:SuzannaLinn_Resident/LuaFuture | Future]]
** [[User:SuzannaLinn_Resident/LuaFuture#When_will_Lua_be_available.3F | When will Lua be available?]]
** [[User:SuzannaLinn_Resident/LuaFuture#Will_LSL_scripts_benefit_from_being_compiled_to_Luau.3F | Will LSL scripts benefit from being compiled to Luau?]]
** [[User:SuzannaLinn_Resident/LuaFuture#Will_Lua_scripts_have_more_memory.3F | Will Lua scripts have more memory?]]
** [[User:SuzannaLinn_Resident/LuaFuture#Will_LSL_continue_to_exist.3F | Will LSL continue to exist?]]
** [[User:SuzannaLinn_Resident/LuaFuture#Will_LSL_receive_updates_with_new_functions.3F | Will LSL receive updates with new functions?]]
** [[User:SuzannaLinn_Resident/LuaFuture#Will_there_be_any_way_to_use_the_functions_not_added_in_LSL.3F | Will there be any way to use the functions not added in LSL?]]
** [[User:SuzannaLinn_Resident/LuaFuture#Will_there_be_a_translator_or_transpiler_to_convert_LSL_source_code_into_Lua_source_code.3F | Will there be a translator or transpiler to convert LSL source code into Lua source code?]]
** [[User:SuzannaLinn_Resident/LuaFuture#Will_we_have_to_move_to_Lua.3F | Will we have to move to Lua?]]
** [[User:SuzannaLinn_Resident/LuaFuture#Should_we_stop_learning_LSL_and_wait_for_Lua.3F | Should we stop learning LSL and wait for Lua?]]
** [[User:SuzannaLinn_Resident/LuaFuture#Will_LuaSL_be_updated_to_the_new_versions_of_Luau.3F | Will LuaSL be updated to the new versions of Luau?]]


Let's look at the advantages of Lua compared to other languages:


* Optimized for efficiency: Lua is designed for fast execution and low memory usage. Its concise set of instructions and data structures helps scripts run quickly and efficiently.
* [[User:SuzannaLinn_Resident/LuaLinks | Links]]
 
** [[User:SuzannaLinn_Resident/LuaLinks#Standard_Lua | Standard Lua]]
* Seamless integration: Lua is built to be embedded in virtual environments, allowing it to interact easily with the platform. It can respond to events and call functions effortlessly, while also being easily restricted to prevent unauthorized access to system resources.
** [[User:SuzannaLinn_Resident/LuaLinks#Luau | Luau]]
 
** [[User:SuzannaLinn_Resident/LuaLinks#Others | Others]]
* User-friendly learning curve: Lua is easy to learn, featuring a small set of keywords and data types. Its simple syntax can be mastered quickly, and its flexibility allows beginners to progressively explore more complex uses.
 
 
And to the advantages of Lua compared to LSL:
 
* Flexible Data Types: Lua supports various data types, providing more versatility in scripting.
 
* Powerful Tables: Lua’s tables allow for lists of lists, enabling complex data structures that are easy to manipulate.
 
* Object-Oriented Programming: Lua supports classes, objects, and inheritance, making it easier to structure and reuse code.
 
* Enhanced Performance: Lua scripts typically execute faster and use less memory than LSL scripts, resulting in a smoother experience in virtual environments.
 
 
In brief: the main advantage is that Lua will work.
 
 
== Which Lua? ==
 
Since Lua is very adaptable, there are various implementations for different programs.
 
Lindens have chosen Luau (pronounced LOO-ow, "ow" like in "how" or "now").
 
It's the scripting language used in Roblox, a platform for games developing, with more than 100 million users.
 
Luau is also the name of a traditional Hawaiian party.
 
So Lua is the language, and Luau is the implementation of the language. Probably we will be seeing both names indistinctly.
 
Luau was developed in 2006, when Lua was at version 5.1. Since then, Luau has introduced its own new features, along with incorporating some of the updates from Lua, though not all. Standard Lua is currently at version 5.4.

Revision as of 00:52, 6 November 2024

Introducing Lua: The New Scripting Language for SL.

In these pages, I am compiling information about Lua and LuaSL to give you an overview of their features and functionalities.


I have opened a topic in the community forums: Expecting Lua. If you have any additional information, questions, comments, opinions or anything else related to Lua in SL that comes to mind, please share them! :)


I will begin a series of in-world classes on LuaSL as soon as it becomes available in the Beta Grid. These classes will be oriented to scripters who primarily use LSL, and they will cover not only Lua but also introduce new programming concepts that are currently absent in LSL.

Once Lua is launched on the Main Grid, I will repeat the same series of classes, allowing you to choose the moment to start your learning journey.

For advanced scripters who have a solid understanding of other programming languages and don't require detailed classes, I will host script meetings and Q&A sessions, to exchange ideas and ask questions.


If LSL is your main scripting language and you want to expand your programming skills beyond SL, learning Lua is a great next step. Lua introduces powerful features and modern programming concepts that will broaden your knowledge and make it easier to transition to modern, in-demand languages like C#, Python, and JavaScript.


Lua index