Hello everyone!
Summarizing a lot, I have a table which is made by another tables (t{ {1,2,3}, {4,5,6} }) named nodes and I need to save table[i] (i.e. a node, which is also a table) in a variable, that’s when defold crashes on debugging, building the project without debugging doesn’t generate any freezing and it does finish the execution of the function where it freezes, but I’m not getting the expected result so something must be wrong. sorry for my English if any mistake was made and thanks in advance
--it freezes just with this
local x = table[1]
the idea is that x contains { 1,2,3 }
Table is a namespace/module provided by the Lua language itself. You can shadow it by local variables and what you show in that line of code should probably work. Can you show a bit more of the code?
Sorry that wasn’t literally the name of the table, here’s what I have:
as_table = {}
nodo = {
id = nil,
x = 0,
y = 0,
f = 0,
g = 0,
h = 0,
nodo = {},
nodoa = nil
}
--add a lot of nodo tables to as_table
--the problem happens when:
local x = as_table[1]
--I want x to be a 'nodo'
PD: I’m trying to implement an A* algorithm, as_table contains each node and each node also contains 4 more nodes which are his neighbors
That code works fine, although the table is empty. Thus x
is nil
.
What do you mean “that’s when defold crashes on debugging”? What happens?
Does it crash? Or does is hang?
If it hangs, what happens if you launch your game, and then attach the debugger (“Debug -> Attach Debugger”) and immediately after that select “Debug -> Break”? Does it in fact show you a place in the code where the debugger stopped?
Also, for some code to look at, here is a simple A* example using tilemaps.
1 Like
It hangs, Defold and the game window turn white and it hangs for a while then it closes the debugging process, I’ll check the code you sent thank you, mine was actually made in javascript and I’m struggling to translate it to lua