X
Xikini
Guest
Had something similar to this (going from memory.. since I fixed the issue...)
The above code gives me this error.. (or something very similar)
For some reason hyphens (-----), cannot be used in the table variables.
Does anyone know why they can't be used?
To fix the issue I simply changed it like below, but it was just a little annoying spending 15 minutes scouring my table trying to find the issue. lol
Anyways,
Posting this is case anyone knows the reason why hyphens can't be used, and in case someone else has the same issue but can't solve it.
Code:
local config = {
[1111] = {break = 50, lesser_value = 0,
normal_item_table = {
[1] = {item_id = 1111, count = 1},
[2] = {item_id = 1111, count = 1}
},
semi-rare_item_table = {
[1] = {item_id = 1111, count = 1},
[2] = {item_id = 1111, count = 1}
},
rare_item_table = {
[1] = {item_id = 1111, count = 1},
[2] = {item_id = 1111, count = 1}
}
},
[2222] = {break = 50, lesser_value = 0,
normal_item_table = {
[1] = {item_id = 1111, count = 1},
[2] = {item_id = 1111, count = 1}
},
semi-rare_item_table = {
[1] = {item_id = 1111, count = 1},
[2] = {item_id = 1111, count = 1}
},
rare_item_table = {
[1] = {item_id = 1111, count = 1},
[2] = {item_id = 1111, count = 1}
}
}
}
Code:
[Error - LuaInterface::loadFile] data/actions/scripts/script.lua:7: '}' expected(to close '{' at line 2) near '=' data/actions/scripts/script.lua
For some reason hyphens (-----), cannot be used in the table variables.
Does anyone know why they can't be used?
To fix the issue I simply changed it like below, but it was just a little annoying spending 15 minutes scouring my table trying to find the issue. lol
Code:
semi-rare_item_table -- old
semi_rare_item_table -- new
["semi-rare_item_table"] -- alternate
^^ (then use a string in my code.. a little too annoying for such a small issue though.)
Anyways,
Posting this is case anyone knows the reason why hyphens can't be used, and in case someone else has the same issue but can't solve it.