Jump to content




Basic LUA questions for Computercraft


  • You cannot reply to this topic
4 replies to this topic

#1 Debugger

  • Members
  • 16 posts

Posted 29 May 2014 - 02:51 PM

First, thank you for helping out. I'm at work daydreaming about being at home testing this out but figured I would get better info asking you guys directly. I know it's my own ignorance but this feels linear like QBasic (thumbs up), and not sure how OOP the default API can be.
  • Can I execute a secondary script without interrupting the first script?
  • Can I return data from the secondary script without interrupting the first script?
  • Can I make my own Classes without having server side access?

Thanks again for the assistance.

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 29 May 2014 - 05:12 PM

1. Sort of.
2. Sort of. Probably not how you're thinking, though.
3. What do you mean by "Classes"?

#3 Lignum

  • Members
  • 558 posts

Posted 29 May 2014 - 05:21 PM

View PostLyqyd, on 29 May 2014 - 05:12 PM, said:

3. What do you mean by "Classes"?
I believe he means classes from object-oriented programming. Yes, you can. It's not as convenient as in other languages but it works.

#4 Debugger

  • Members
  • 16 posts

Posted 29 May 2014 - 05:30 PM

Thanks for the reply Lyqyd.

Classes: like a permanent function/method on another script outside of the current scope of the script currently running. I suppose it could be fudged by having other terminals running individual scripts and grabbing variables from those when needed. I don't know though =x

View PostLignum, on 29 May 2014 - 05:21 PM, said:

View PostLyqyd, on 29 May 2014 - 05:12 PM, said:

3. What do you mean by "Classes"?
I believe he means classes from object-oriented programming. Yes, you can. It's not as convenient as in other languages but it works.
Perfect! I'll take a gander.

#5 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 30 May 2014 - 12:13 AM

It sounds like you may find this API tutorial to be worth a read.

If there's a specific block of code you intend to port or whatever, then you may be better off linking to (or at least describing) it here. We can't really comment on the best way to do something in Lua without knowing exactly what that something is.

Lua is indeed very similar to QB, but (at least in CC) you'll be relying a lot on events.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users