Welcome aboard Visitor...

Daily Screenshot

Server Costs Target

Time running out!

54% of target met.

Latest Topics

- Anyone still playing from a decade ago or longer? »
- Game still active. NICE! »
- Password resett »
- Darkspace Idea/Opinion Submission Thread »
- Rank Bug maybe? »
- Next patch .... »
- Nobody will remember me...but. »
- 22 years...asking for help from one community to another »
- DS on Ubuntu? »
- Medal Breakpoints »

Development Blog

- Roadmap »
- Hello strangers, it’s been a while... »
- State of DarkSpace Development »
- Potential planetary interdictor changes! »
- The Silent Cartographer »

Combat Kills

Combat kills in last 24 hours:
No kills today... yet.

Upcoming Events

- Weekly DarkSpace
03/30/24 +1.8 Days

Search

Anniversaries

No anniversaries today.

Social Media

Why not join us on Discord for a chat, or follow us on Twitter or Facebook for more information and fan updates?

Network

DarkSpace
DarkSpace - Beta
Palestar

[FAQ
Forum Index » » Basic Scripting Discussion » » Need some help w/ Lua tables
 Author Need some help w/ Lua tables
Binks
1st Rear Admiral

Joined: November 28, 2003
Posts: 469
Posted: 2005-08-02 13:07   
Okay, I'm relatively new to programming as a whole (done some games/utilities in C# and that's it) and I need help. Ever since I first discovered how to work the editor I've wondered how to script, and wanted to be able to access the Adv. script area to learn editor scripting.

Until a few days ago I kept putting off learning scripting because I really didn't want to spend the time learning a new programming language. However since I had some free time I decided to try. Mainly through trial and error I've learned a lot about Lua since then, and have built a program that can do what is required for the first 3 steps of the Lua excercises but then I get to the table and I have no clue how to get that to work at all. The manual is incredably vague when it comes to tables, and the code it tells you to use to make a table doesn't work. Can anyone tell me how to make a table? That's really all I think I'll need to know to complete the majority of the training things, other than 9 which will take some in-depth searching about recieving input I'm sure (C# seems much better in that regard...just a simple "int.parse (textboxname)"...). Thanks for any help!
_________________
Midshipmen still need Engineering or Supply Ships

Powered by Stormtroopers and Red Shirts

Shigernafy
Admiral

Joined: May 29, 2001
Posts: 5726
From: The Land of Taxation without Representation
Posted: 2005-08-02 17:28   
On a side note, the advanced scripting forum isn't a holy grail of scripting information; on the contrary, its mainly me complaining that I can't get simple things to work, and then occaisional threads that we move from the basic forum because people are posting scripts on how to do stupid things like make spheres of Gaifen around unsuspecting newbs (ok, haven't seen that one yet.. which would actually be kinda fun.. er.. Right.)

So don't think that you'll suddenly discover guides, examples, and instant knowledge of all that is lua, if/when you gain access to that forum.
Though feel free to add guides, examples, and such if you do ever get in..

As for your real question: uhh...
I don't know.

What was the question again?
_________________
* [S.W]AdmBito @55321 Sent \"I dunno; the French had a few missteps. But they're on the right track, one headbutt at a time.\"

  Email Shigernafy
Shigernafy
Admiral

Joined: May 29, 2001
Posts: 5726
From: The Land of Taxation without Representation
Posted: 2005-08-02 17:31   
Right.

Have you checked out the Lua Tutorials Wiki? It has a page on Tables, right at the top there.

Tables are basically just arrays, if you're used to them in other languages.. and I'd hope you are, since they're eminently handy; its hard to get by doing much without using one at some point. Or, it makes life easier to use them.
_________________
* [S.W]AdmBito @55321 Sent \"I dunno; the French had a few missteps. But they're on the right track, one headbutt at a time.\"

  Email Shigernafy
Binks
1st Rear Admiral

Joined: November 28, 2003
Posts: 469
Posted: 2005-08-02 18:58   
Thanks shig...actually I've never used tables before in my limited programming experiance...that wiki helped a lot.
_________________
Midshipmen still need Engineering or Supply Ships

Powered by Stormtroopers and Red Shirts

c0ld
Midshipman

Joined: June 24, 2003
Posts: 342
From: UK
Posted: 2005-08-03 12:47   
The only thing I remember about lua, is that is doesn't produce a sorted numbered array when you itterate into one. Functions like tablesort etc were only semi effective at fixing it.

As a simple analagy, it's like counting from one to ten, then asking someone else to repeat it back, only to hear a jumbled, seemly randomized version of it.

That translates into '.. Is Crap' in my lingo, but maybe I was just being dumb and didn't get it tho. I figured it had something to do with the way lua writes a table to memory (ie 'badly').

[ This Message was edited by: c0ldfury on 2005-08-03 13:03 ]
_________________


Shigernafy
Admiral

Joined: May 29, 2001
Posts: 5726
From: The Land of Taxation without Representation
Posted: 2005-08-07 22:37   
How's it coming along?
_________________
* [S.W]AdmBito @55321 Sent \"I dunno; the French had a few missteps. But they're on the right track, one headbutt at a time.\"

  Email Shigernafy
Drafell
Grand Admiral
Mythica

Joined: May 30, 2003
Posts: 2449
From: United Kingdom
Posted: 2005-08-10 08:49   
Aren't LUA tables made from the wood of a Binary Tree?
_________________
It's gone now, no longer here...Yet still I see, and still I fear.rnrn
rnrn
DarkSpace Developer - Retired

  Goto the website of Drafell
Fattierob
Vice Admiral

Joined: April 25, 2003
Posts: 4059
Posted: 2005-08-17 18:59   
Quote:

On 2005-08-10 08:49, Drafell wrote:
Aren't LUA tables made from the wood of a Binary Tree?




ba dum tsh
_________________


Binks
1st Rear Admiral

Joined: November 28, 2003
Posts: 469
Posted: 2005-08-20 20:42   
Quote:

On 2005-08-07 22:37, Shig - on vacation wrote:
How's it coming along?



Lol...it's not ...I've pretty much decided that until I have a ton of free time again (school drains free time better than any game) I'm gonna spend my time having fun rather than trying to get Lua to work...I did managed to get half of my problem done...I just need to figure out how to make Lua convert a number into binary (I assume by ASCII you mean binary not some odd |-| | thing...)...those guides at least got me half-way

EDIT:ASCII Chars? Well, that'll probably prove to be very helpful information when I start trying to finish this again...thanks cold


[ This Message was edited by: Binks(Give Midshipmen Sup/Engy) on 2005-08-21 10:14 ]
_________________
Midshipmen still need Engineering or Supply Ships

Powered by Stormtroopers and Red Shirts

c0ld
Midshipman

Joined: June 24, 2003
Posts: 342
From: UK
Posted: 2005-08-21 08:42   
No, they mean ASCII char not binary.

There is a function in lua that does that quite simply, but I think you'll have to search for it yourself on wiki. I don't want to give the game away.

[ This Message was edited by: c0ldfury on 2005-08-21 09:25 ]
_________________


Chromix
Cadet

Joined: June 29, 2001
Posts: 3052
Posted: 2005-08-29 17:17   
Quote:
The only thing I remember about lua, is that is doesn't produce a sorted numbered array when you itterate into one. Functions like tablesort etc were only semi effective at fixing it.


Actually you can get a perfectly sorted output/iterator/loop, without having to sort the table (if you use the table as normal array).
Its just a single (short) line thats documented in the manual
_________________


  Email Chromix
c0ld
Midshipman

Joined: June 24, 2003
Posts: 342
From: UK
Posted: 2005-09-03 04:39   
Damn it! Now you've said that, I'll have to download Lua and learn to use it all over again.
_________________


Page created in 0.018163 seconds.


Copyright © 2000 - 2024 Palestar Inc. All rights reserved worldwide.
Terms of use - DarkSpace is a Registered Trademark of PALESTAR