Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
147 views

I am making a card game and im now revamping how individual card information is stored. a single card would have the following values: x, y, suit, number, state this is to be stored in a deck array ...
Mounif Alzougbi's user avatar
2 votes
3 answers
106 views

As I understand Lua, an array is just a table where the keys start at 1 and increment sequentially. However, there are features within Lua to manipulate arrays in the traditional sense (e.g. ipairs, ...
deltamind106's user avatar
0 votes
2 answers
84 views

I'm trying to make a dance floor that lights up and changes colors periodically. So far I've gotten the game to load and pick a random color from the array upon loading, but I can't make the tiles ...
Shinikage's user avatar
-1 votes
1 answer
78 views

I program in Lua and I need some help: I have file1.lua and file2.lua In file1.lua: loadstring('print("Hello World!")') in file2.lua: _loadstring = loadstring function loadstring(code) ...
kaleb sociais's user avatar
3 votes
1 answer
80 views

I started learning Lua recently, as far as I can tell, when I don't specify the index, the function table.insert tries to put the value in the first nil in the table. Why then is it that in table t ...
Rafael's user avatar
  • 31
1 vote
1 answer
100 views

In lua, if we try to index a series of nested table (any of which can be nil), we might write code like this: -- try to get a.b.c local ret if a then local b = a.b if b then ret = b.c ...
lhh2001's user avatar
  • 31
2 votes
1 answer
30 views

Here's code for a timer: local copyTable = require("Helpers.copyTable") local timer = {} timer.max = 0 timer.time = 0 function timer:add(dt) timer.time = timer.time + dt end function ...
Jackson Kidwell's user avatar
1 vote
1 answer
80 views

So I'm trying to make a table of all the creatures in a game, each creature consisting of a table with their stats. I used the creature's name as the key in the first table, but now I need to get that ...
Gabriel's user avatar
  • 25
0 votes
1 answer
82 views

I am at a complete loss with the syntax to parse a LuaTable. I have a table that follows the following structure: mission = { ["coalition"] = { ["blue"] = ...
Francisco Benito's user avatar
1 vote
1 answer
64 views

A function f() returns multiple values, which are to be fed into a second function g(). I cannot change f(), but I can change g() and all calls to it. I'm wondering if it's possible to say which ...
finefoot's user avatar
  • 11.6k
2 votes
0 answers
101 views

I is possible to change the default hash function that lua (or luajit) uses for the HashTable part of a talbe ? I want to speedup table access in pure Lua. I saw that: The Default hash function for ...
Benjamin V's user avatar
4 votes
2 answers
446 views

Since Lua 5.4, the <const> syntax lets us set const variables. I noticed that this doesn't transitively affect fields inside a table. local x <const> = { a = {1,2,3}, b = {5,6,7} } ...
rbv's user avatar
  • 505
2 votes
1 answer
171 views

I did find a version of this for a string into a table that splits up the letters of the string, but I have a table, that I turn into a string to remove the first part of it, and now I want it back as ...
Asher Roland's user avatar
1 vote
1 answer
75 views

I am reading Programming in Lua, 4th edition with an intention to solve every exercise in that book. The last exercise in Chapter 21 p. 172 is the following (emphs are mine): A variation of the dual ...
LRDPRDX's user avatar
  • 691
2 votes
3 answers
2k views

I want to keep a list of words (let's say 20k). The only purpose of it is to check if the given word exists there. So, it's going be something known as a hash set. -- dict here is just an example, it'...
papirosnik's user avatar
-1 votes
1 answer
100 views

I want to make a Table in lua with io.read, This is my code: local members = {} io.write("How many members you wanna add? ") local memberNum = io.read("n") print("Add new ...
M3gan3_sama's user avatar
2 votes
1 answer
76 views

I want to create a nested table, that shall look like this: { SA_1: {1,2,3,4}, SA_2: {11,22,33,44} } The code I have (I changed the SA_2 to strings for testing purposes): int myRegisteredCfunc: { ...
ddomnik's user avatar
  • 73
0 votes
1 answer
333 views

I have an object moving "freely" with body:applyForce( x, y ). I want to track it's previous position. I set a timer and with every second that goes by i get the position of the moving ...
jon's user avatar
  • 1
0 votes
0 answers
104 views

I have a table t which is totally dynamic: it is nested, and number of levels is unknown in advance. I wish to be able to set (get is easy to do) some value at some level, using a kind of path. The ...
Hermios's user avatar
  • 634
0 votes
0 answers
22 views

I'm working on a Roblox overhead GUI and I'm using a moduleScript for the values. It currently pulls a random value of its liking instead of abiding to the parameters. The (relevant) part of the ...
hard R's user avatar
  • 3
0 votes
1 answer
101 views

Below is a sample table structure of what I am wanting to sort. Data = { ["C1_RN1::F1"] = { ["class"] = "Hunter", ["name"] = "C1",...
AeroMaxx's user avatar
  • 207
2 votes
1 answer
72 views

I made a program, which checks if in table has (for example) "A" and a "B" in itself. But it doesn't works. Here's code: function inTable(t,e) return t[e] ~= nil end --Example ...
unwritten_k's user avatar
0 votes
0 answers
105 views

The core detail of my problem is: I don't know how to do it. I encountered the problem I'm trying to solve by wanting to add a table to an existing table in Lua. The major difficulty that prevented me ...
DrDreadful's user avatar
0 votes
1 answer
354 views

Let's say I have this code: local testtbl = {"foo", "bar", "baz"} How do I get the index of an element? For example: print(indexOf(testtbl, "bar")) -- 2
berriz44's user avatar
1 vote
1 answer
117 views

I've the following lua script, in which I use a C++ function that needs to read both keys and values of a nested table: local scenariolist = { scenarios = { 'scenario1', 'scenario3', ...
Jepessen's user avatar
  • 12.6k

1
2 3 4 5
29