Log In  

Hello good people of the Picotron! First time posting. I apologize if I<m not posting in the right forum, but I<m a bit lost in the current layout of the site.

I'm a amateur programmer who never went too far qith this hobby, so I thought maybe something meant to be "easy" like Picotron could be a thing for me, the eternal wannabe game designer.

My question to day is about tables.

I can<t quite get them to work. I use simple one dimension arrays, but I need more of a Pascal-type of record, and when I read the Lua documentation, it seems to be possible, but my code doesn<t compile when I try to create tables with more than one dimension or different types of variable. It<s a syntax problem. I know what I want to do, but I can't find the right syntax.

For instance, in my RPG, there will be a party of six characters. So I need a table with at least a string column for the name of the character, a number column for the character sprite number, one column each for the chacter<s abilities. At the end of the day, there will be a lot of data in that table.

So, if anybody is kind and knowledeable enough to help me, a little crash course on tables would be appreciated.

Thanks a lot and please refer me to the right forum if I<m in the wrong place.

Hinou Profane

P#148026 2024-05-06 21:58

hello and welcome! I don’t know the pascal concepts you refer to, and can’t help with your lua code that doesn’t run (your message says «doesn’t compile») without seeing it!

this is a general guide to explain lua tables: https://www.lexaloffle.com/bbs/?tid=44686
they are key-value mappings that also work as sequences of things

this other guide goes more in depth on some aspects: https://www.lexaloffle.com/bbs/?tid=141946

P#148031 2024-05-06 23:52

Thank you, that's good reading material. I just found how to correctly format multi-dimensional arrays. It was really a matter of putting the right characters in the right sequence. The brackets go at the end of the variable, always. The logic of the language is very fluid, almost too much. It's like they want it si simple that they make it less obvious than a more explicit language.
But I made progress, that's a good thing.

P#148051 2024-05-07 10:14

[Please log in to post a comment]