Jump to content




Some lua tricks you may not have known...


106 replies to this topic

#1 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 20 August 2012 - 09:51 AM

*
POPULAR

EDIT: Hey, it's me from the future. Lots of stuff has changed, one of those things being that I'm not all that interested in CC or Lua that much anymore. But it seems like some people are still stumbling upon this (badly written) post! Since there's still some interest in it, thanks to SquidDev, you can view the full formatted post here. The rest of this post remains, as always, for reference.

---

I've rewritten the Lua Tricks tutorial and hosted it on my github page. You can access it here: http://kingdaro.gith...lua-tricks.html

Old content for reference:

Spoiler

Edited by Kingdaro, 25 February 2019 - 08:28 AM.


#2 FuzzyPurp

    Part-Time Ninja

  • Members
  • 510 posts
  • LocationHarlem, NY

Posted 20 August 2012 - 10:07 AM

Nice Thread!

#3 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 20 August 2012 - 01:55 PM

I learned a few things here! +1 for you!

#4 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 20 August 2012 - 02:48 PM

Thanks guys. :D/>

#5 Graypup

  • Members
  • 90 posts

Posted 24 August 2012 - 12:26 AM

Nice, now we just have to convince the noobs to read programming in lua :D/>.

#6 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 24 August 2012 - 04:46 AM

Reformatted the post and reorganized/added some more information.

#7 nitrogenfingers

    Lua Professor

  • Members
  • 551 posts
  • LocationAustralia

Posted 24 August 2012 - 08:18 AM

Nice topic, picked up a few tips I wasn't familiar with. Thanks for posting!

One small thing though, you mention you can use strings to access non-string indexed fields in tables. That's actually another little eccentricity in lua as the statements
table example = {
  ["a"] = 1;
  ["b"] = 2;
}
and
table example = {
  a = 1;
  b = 2;
}

Are actually equivalent, which also means that

print example.a
and
print example["a"]

Are also equivalent. I learnt that a few weeks ago, rather nice bit of syntactic sugar.

#8 TntTerminal

  • New Members
  • 3 posts

Posted 26 August 2012 - 06:35 PM

Thank you this helped me a lot! Especially using a ' instead of a " because when i type a " nothing appears, but when i type anything else it appears but what i typed dont. For example: if i type: "hello" It appears "ello" so i need to type "h" two times, i dont know why.

#9 Noodle

  • Members
  • 989 posts
  • LocationSometime.

Posted 27 August 2012 - 03:09 AM

Nice work!

#10 ETHANATOR360

  • Members
  • 423 posts
  • Locationyour hardrive

Posted 31 August 2012 - 07:07 PM

very good +1

#11 kaj

  • Members
  • 43 posts

Posted 01 September 2012 - 08:54 AM

Thanks for this.
Favorited / +1
I'm finding this really helpful.

#12 Jajnick

  • New Members
  • 41 posts
  • LocationPoland

Posted 03 September 2012 - 10:02 AM

Everybody who have checked lua-users wiki knows that...

#13 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 03 September 2012 - 06:49 PM

 Jajnick, on 03 September 2012 - 10:02 AM, said:

Everybody who have checked lua-users wiki knows that...
The people here tend to have not even have heard of lua before discovering ComputerCraft.

#14 Jajnick

  • New Members
  • 41 posts
  • LocationPoland

Posted 03 September 2012 - 07:16 PM

 Kingdaro, on 03 September 2012 - 06:49 PM, said:

 Jajnick, on 03 September 2012 - 10:02 AM, said:

Everybody who have checked lua-users wiki knows that...
The people here tend to have not even have heard of lua before discovering ComputerCraft.
That's interesting! I was exactly in the same situation, and the first thing I've done was checking Google, keyword: lua tutorial. First result? Lua-users.
Have those people not heard of Google? I don't think so.

There is no excuse for human thoughtlessness. Understand it.

#15 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 03 September 2012 - 07:29 PM

He's just sharing his knowledge. Sure it can be found elsewhere, but I don't see the harm in it being here.

#16 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 03 September 2012 - 11:55 PM

 Jajnick, on 03 September 2012 - 07:16 PM, said:

That's interesting! I was exactly in the same situation, and the first thing I've done was checking Google, keyword: lua tutorial. First result? Lua-users.
Have those people not heard of Google? I don't think so.

There is no excuse for human thoughtlessness. Understand it.
I'm basing my knowledge of others' knowledge through looking at the programs people have displayed, and as far as I've seen the examples I've given have been scarcely used.

 Cloudy, on 03 September 2012 - 07:29 PM, said:

He's just sharing his knowledge. Sure it can be found elsewhere, but I don't see the harm in it being here.
Exactly this.

#17 NIN3

  • New Members
  • 57 posts
  • LocationEverywhere.

Posted 04 September 2012 - 01:45 AM

You sir, deserve a one up. Thank you for making my scripts just a wee bit neater!

#18 FuzzyPurp

    Part-Time Ninja

  • Members
  • 510 posts
  • LocationHarlem, NY

Posted 06 September 2012 - 08:02 AM

 NIN3, on 04 September 2012 - 01:45 AM, said:

You sir, deserve a one up. Thank you for making my scripts just a wee bit neater!

Then click the + button at the bottom right of his initial Post. 9 people have so far it seems.

#19 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 08 September 2012 - 04:00 PM

Still adding on as I learn more wonderful things about lua's flexibility.

Thanks for the rep, guys. :D/>

#20 sjele

  • Members
  • 334 posts
  • LocationSomewhere on the planet called earth

Posted 08 September 2012 - 07:53 PM

This is nice :D/>

"Scrolling up to hit +1"





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users