Posted: 14th Jun 2007 21:36
Well, my game will run fine until I put one particular function into it. Anyways, it crashes without error. Here's the related code:

The function that crashes the game
+ Code Snippet
function addskill(class$,type$,name$)
    s1=freeskill()
    skills(s1).name = lua array string("Skills->" + class$ + "->" + type$ + "=>" + name$ + "->name")
    skills(s1).manacost = lua array int("Skills->" + class$ + "->" + type$ + "=>" + name$ + "->manacost")
    skills(s1).damage = lua array int("Skills->" + class$ + "->" + type$ + "=>" + name$ + "->damage")
    skills(s1).area = lua array int("Skills->" + class$ + "->" + type$ + "=>" + name$ + "->area")
    skills(s1).toggle = lua array int("Skills->" + class$ + "->" + type$ + "=>" + name$ + "->toggle")
    skills(s1).effect = lua array string("Skills->" + class$ + "->" + type$ + "=>" + name$ + "->effect")
    skills(s1).element1 = lua array int("Skills->" + class$ + "->" + type$ + "=>" + name$ + "->element1")
    skills(s1).element2 = lua array int("Skills->" + class$ + "->" + type$ + "=>" + name$ + "->element2")
    skills(s1).element3 = lua array int("Skills->" + class$ + "->" + type$ + "=>" + name$ + "->element3")
endfunction


Here's the freeskill() function
+ Code Snippet
function freeskill()
    repeat
        inc s
    until skills(s).name=""
endfunction s


and here's the LUA file that I call from
+ Code Snippet
Skills = {
    Race = {
        Elf = {
            Speed = {
                name = "Speed Increase",
                manacost = 0,
                damage = 0,
                area = 0,
                toggle = 1,
                effect = "Boost",
                element1 = 1,
                element2 = 2,
                element3 = 1,
            }
        }
    }
}


Now, this looks like it would work fine to me, but it crashes my game. All help is appreciated.

P.S. I am using the Unity plugin.

Thanks,
Jaden
Posted: 14th Jun 2007 21:46
It's probably crashing when it gets to the string LUA call because that array doesn't exist. LUA will call an empty integer or float just fine, but it chokes when you request a string that doesn't exist.

Print out the string that you're passing to LUA and see if it's right. I get this error more than I'd like to, and that's how I fix it.
Posted: 14th Jun 2007 22:03
Well, I found the error. I made a simple, tiny mistake. I had => where it should have been ->. It works fine now, but thanks a ton Cash.

P.S. I really, really like Geisha House. Can't wait to buy it.

Thanks,
Jaden