Log In  

I understand Pico-8 has a subset of the full Lua language. However, I wonder is there enough of it there to make the following book useful: https://www.amazon.com/Programming-Lua-Fourth-Roberto-Ierusalimschy/dp/8590379868/ref=pd_lpo_sbs_14_t_0?_encoding=UTF8&psc=1&refRID=JKY5ABS0S7DB70RF732Z

Does anyone have this and did it help you?

I've been able to get by picking up a smattering of lua syntax just online, but I enjoy the idea of getting a deeper look at the language. However since Pico-8 is the only platform on which I'm extensively using Lua, I want to make sure the investment would be worth it.

P#50146 2018-03-09 12:32 ( Edited 2018-03-09 17:32)

I'm not sure how useful it would be...Lua is a pretty simple language to begin with, compared to a lot of others...and the PICO-8 subset makes it even simpler.

I guess I'm just not sure what a book could tell you that you couldn't easily find online (e.g. lua.org, lua-users.org)...I've never had to look at any books personally; I've found the web to be a sufficient source of Lua information. But you may be more book-oriented in your learning style, so I guess only you would know if it would be more helpful :)

P#50154 2018-03-09 15:30 ( Edited 2018-03-09 20:45)
:: Felice

@gradualgames

How experienced are you with other languages? That might be useful in deciding whether or not you could use extra learning materials.

These days, I've been exposed to so many languages that I can mostly just poke around and figure out what the language's version of functionality X looks like and I'm good to go. Sure, there are a few weird ones where the whole paradigm is different, but mostly if you're already familiar with programming and with fundamental algorithms, it's usually just a matter of spotting an unfamiliar form of an otherwise-familiar function.

P#50161 2018-03-09 17:31 ( Edited 2018-03-09 22:31)

Programming Lua is 1/2 about the language features, 1/4 about the Lua standard library, and 1/4 about embedding the Lua interpreter in a C application. Only the first half is relevant to Pico-8, and there are minor differences to watch out for. Also, the 4th edition covers Lua 5.3, and Pico-8 uses Lua 5.2, so there'd be some minor pitfalls in that regard as well.

The first edition of Programming Lua is free online, covering up to Lua 5.0: https://www.lua.org/pil/contents.html

I'd say it's mostly not worth it for most Pico-8 devs. You'll get more from online materials and Pico-8 specific examples. If you like languages in general (like I do :) ), downloading the Lua interpreter and playing with the book is a good time, and you'll learn stuff for Pico-8 if you're willing to do some minor translation and experimentation.

It's hardly a complete language guide, but you might enjoy a quick read through the Lua page of the Pico-8 wiki. Bouncing around the API reference might also be of interest. I tried to make sure every function has code examples.

P#50171 2018-03-09 21:09 ( Edited 2018-03-10 02:09)

I probably don't need the book. I've picked up everything I think I need to know for Pico-8, even going so far as using coroutines. I guess I just liked the idea of learning some Lua idioms that I might not pick up until later or something. But given that Pico-8 does not have the full language maybe I wouldn't be able to employ everything I learn anyway.

I mainly just liked the idea of having a yummy smelling new book for my shelf and support the guys who created Lua. Though I wonder if Lexaloffle has supported Lua at all, so I'd be supporting it indirectly by having purchased Pico-8 to begin with.

P#50187 2018-03-10 11:03 ( Edited 2018-03-11 18:12)
:: Felice

Well, PICO-8 has the full language, it just doesn't have the full support library. If you're familiar with C++, it's a lot like having a C++ compiler, but no STL. Or C# without the .NET libraries.

Ideally, I think a PICO-8 programmer would probably learn the most by reading material by/for people who write Lua modules/libraries. By that, I mean people who have to write things in Lua from scratch, building things other people build on top of. Those are the people who are going to know the best tricks.

P#50189 2018-03-10 11:14 ( Edited 2018-03-10 16:14)

I fully endorse buying the book for the sweet paper smell and supporting the Lua project. :)

The Pico-8 pitfalls with Lua docs are minor and are mostly about various built-ins being missing with no equivalent. I'm not complaining, just saying it might be confusing for people new to the language. Examples in early chapters in Programming Lua require a bit of mindful translation.

I learned about Lua iterators going through the book just now looking for things that might break. And they work in Pico-8! So there's another endorsement for the book.

function list_iter(t)
 local i = 0
 local n = #t
 return function()
  i += 1
  if (i <= n) then
   return tostr(i)..": "..t[i]
  end
 end
end

x = {"alpha", "beta", "gamma"}
for element in list_iter(x) do
 print(element)
end
P#50208 2018-03-10 18:51 ( Edited 2018-03-10 23:52)
:: Felice

Yeah, iterators are cool. Sadly, they can be pretty expensive if you don't use the default pairs() iterator. But still, it's really nice to have the flexibility to write your own, and the work required to do it isn't onerous like it is in C++. Writing a full, robust iterator in C++ can be paaaiiiinful.

P#50213 2018-03-10 19:58 ( Edited 2018-03-11 00:58)

I wound up getting the book. I already learned a couple of surprising things, such as the a ? b : c idiom:

(a and b or c)

and that

if 0 then print "hi" end

will actually print "hi." That threw me for a loop :D

Glad I got the book. And after it warmed up from being out in the cold, it DOES smell yummy.

P#50397 2018-03-14 09:27 ( Edited 2018-03-14 13:28)

[Please log in to post a comment]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-10-22 15:23 | 0.024s | 4194k | Q:26