ID:1254050
 
Keywords: expression, list, missing
(See the best response by Hiead.)
Code:
proc
SaveLists(var/mob/M)
set background=1
//boughtskills //1
var/SQLQuerya
if(M.boughtskills.len)
SQLQuerya+="UPDATE boughtskills SET name='[M.name]'"
var/ia=0
while(ia<=M.boughtskills.len)
ia++
sleep(1)
if(M.boughtskills[ia])
SQLQuerya+=",listid='[ia]'"
SQLQuerya+=",listvalue='[M.boughtskills[ia]]'"
SQLQuerya+="WHERE name='[M.name]'"


Problem description:
I am getting a missing expression error on the line:
SQLQuerya+=",listvalue='[M.boughtskills[ia]]'"


But surely if this was the case it would throw and error on the:
if(M.boughtskills[ia])


Is this something that you have to work arround like in this post: http://www.byond.com/ forum/?post=80701&hl=missing%20expression%20list

Help :D
Just an aside, I'd start that last addition with a space so WHERE isn't touching anything. Not the cause of this problem.
noted that, Im wondering how to re-write the code, but list indices is by far the nicest approach to this.
Best response
Unfortunately, I'm on-duty at work tonight without access to my computer, so I'm posting from my iPhone and unable to test to see if this is another compiler bug (interesting that you linked to an old post of mine!). Have you tried creating a temp variable like in my workaround section of that post, and compiling? Or, possibly, spacing out the ']' so they're not touching?
Oh wow, seriously, is that all there was to it.. Man I feel so dim, I was thinking of various ways to redo the code(I had none). Thanks a lot man

[ value[] ] works but [value[]] is buggy? is this a compiler bug?
In response to Jean Sqribe
I'm sure [M.list_var["[ia]"]] works.
Tried that, you get a bad embedded expression error.
In response to Jean Sqribe
How do you have the list defined? I have zero errors.

var
list
L
L2 = new
L3 = list()
L4

proc
test()
for(var/a in L)
world << "[L["[a]"]]"
for(var/a in L2)
world << "[L[a]]"
for(var/a in L3)
world << "[L[a]]"
for(var/a in L4)
world << "[L[a]]"
L3 format is how I have my list defined.
In response to Jean Sqribe
        for(var/a in L3)
world << "[L["[a]"]]"

I have it like so and I'm not having any compiling errors.
In response to Boubi
Boubi wrote:
        for(var/a in L3)
> world << "[L["[a]"]]"

I have it like so and I'm not having any compiling errors.

I have tested this on a smaller project that I am developing, and it seems to be compiling there with no issues. I wonder if there is something that I have done to my main project to make it picky when compiling things...

I started programming this project like 3 years ago, maybe old code is not backwards compatible to the new fixes in the latest BYOND version.. I dont know but im happy its working :D