Modding Help Lua : Always getting ConversionException when getting Entity ID

Discussion in 'Starbound Modding' started by g748067, Dec 29, 2016.

Thread Status:
Not open for further replies.
  1. g748067

    g748067 Void-Bound Voyager

    Hello,

    As the title says, I always get the error :

    Code:
    ... (LuaException) Error code 2, [string "/xxx.lua"]:38: (LuaConversionException) Error converting LuaValue to type 'i'
    
    Here's my code :

    ( it feels like world.spawnMonster does'nt return a EntityId type, but a LuaValue type, don't know why ... )

    Code:
    Bind.create("g", function()
    
        cusorPosition = tech.aimPosition()
    
        local monsterId = world.spawnMonster("micropo", cusorPosition, { level = 1 })
    
    
        if world.entityExists(monsterId) then    -- << ERROR HERE
    
            sb.logInfo("EXIST!")
        end
    
    end)
    
    Pretty simple uh ? I still don't get why it fails ...


    Thanks everyone! :)
     
  2. Okaghana

    Okaghana Space Hobo

    Have you tried logging the monsterId directly after fetching it? Maybe you also could check whether the ID is a correct one, and not a nil-value due to an error in the spawning of the monster.
     
  3. Iris Blanche

    Iris Blanche Pudding Paradox Forum Moderator

    Please look at the date when replying to posts. This post is from 2016 and the user hasn't been online since over a year. Unnecessary necroposting is against our forum rules.
    I am closing this one.
     
Thread Status:
Not open for further replies.

Share This Page