/lua/ - Lua Users Anonymous

#1 - Good morning edition.

Friendly discussion, learn and share!

>What is Lua?
Lua is a lightweight, flexible language designed primarily to script compiled applications. It's fast and is commonly used in game engines.

>Tools
Lua: lua.org
VS Code: code.visualstudio.com/
Lua Extension: github.com/sumneko/lua-language-server
Teal, a typed dialect of lua: github.com/teal-language/tl
Teal Extension: github.com/teal-language/vscode-teal

>Learn
lua.org/pil/contents.html
lua.org/manual/5.1/
tylerneylon.com/a/learn-lua/ (learn basic syntax in 15 minutes)
youtube.com/watch?v=S4eNl1rA1Ns (more in depth, assumes some programming experience)

wiki.facepunch.com/gmod/Beginner_Tutorial_Intro (Garry's Mod)
youtube.com/watch?v=wttKHL90Ank (Love2D)

>help wanted: more/better resources!

>Host Applications
en.wikipedia.org/wiki/List_of_applications_using_Lua
You can use Lua to write scripts for Garry's Mod, Roblox, Love2D, WoW, weechat, wireshark, and more!

Attached: lua_good_morning.png (505x512, 105.15K)

Other urls found in this thread:

orbitalquark.github.io/textadept/
luvit.io/
twitter.com/SFWRedditVideos

>Good morning sirs

Attached: 1658321128639255.jpg (715x1226, 133.62K)

After tinkering with it for a couple of years now ricing my awesome desktop I've come to really like it. It could use a built in async library though

This reminds me to Textadept. Is a nice pet project and is very well documented but honestly GTK doesn't cut for a good multiplatform experience. Either Notepad++ or Gedit are faster for their respective platforms and neovim just werks on every OS i care about.

Attached: 1658433624625.jpg (742x781, 55.61K)

>>help wanted: more/better resources!
i'll shill sol2 then. It's an embedding lib for C++, it can handle classes, inheritance, function and method overloading, and according to the benchmark is generally the fastest thing in it's category. It can do pretty much anything.

>It could use a built in async library though
Async file io? Some host applications provide an API for that, and there are a few binary modules that provide it. I recall one being implemented with rust/tokio.

Speaking of async, I recently read the rust futures crate, learned a lot about how their async API works, and started implementing something similar in Teal. The exercise was very enlightening.

¿Qué?

Attached: Screenshot from 2022-07-15 03-53-07.png (916x801, 113.38K)

orbitalquark.github.io/textadept/

This is for hosting Lua inside your application, right? Can it be used to build binary modules?

binary modules you can require in a Lua script*

they should make a lua2 where variables are local by default and some other basic design things the language got wrong

luvit.io/

Honestly I am not sure, I don't think so. I use it in a homebrew game project where I can pass stuff back and forth between C++ and Lua and write my logic in Lua referencing C++ functions. For that it can pretty much to everything I could think of when trying out features.

What are you referring to? The REPL in in the 1 hour video?

>indexing begins at 1
For what reason? Not trolling just a noob.

The whole text editor. I used it for a month as replacement for Gedit + Notepad++. Isn't bad but isn't good enough IMO. It has a lot of neat features but is slower (on Wind*ws at least) and less intuitive.

My guess is that it eliminates the need to write array.length - 1 (#table - 1) when iterating over an array. There are no use cases for arrays starting with 0 in Lua anyway and when you need it you can always work around it since table[0] is a valid construct in Lua

It might have been to make it easier to understand for non programmers. Ordinals[1] vs offset[0]. Here is their discussion on it:
lua-users.org/wiki/CountingFromOne

Teal meets you half way and makes you declare globals with the global keyword. You still need to declare locals with local, but you can no longer accidentally declare globals when you forget the local keyword. It would be a compiler error / red squiggly.

Lua is very flexible.

Here is an example of an Option type constructor. This design affords you data privacy and fine grained access control. No metatables or class libraries necessary, and methods are called with the dot operator.

Attached: Screenshot from 2022-07-21 18-06-07.png (847x767, 95.73K)

It's just an old-fashioned convention that you see in old languages like Fortran and ADA. Lua is from 1993 so the decision was likely influenced by that fact.

iirc the guy who made lua was a researcher at some br uni he was probably using matlab where indexes start at 1 too

Is this a good beginner language? I heard even 10 year olds can learn it