Config.ini wird per Skript nicht geladen

  • #1, by crankschenkThursday, 29. November 2018, 14:15 5 years ago
    Hallo allerseits,

    ich habe ein kleines Problem mit der Config.ini, die ich über das Skript aus dem Wiki einlese:

    Dadurch wird auch leider Fullscreen nicht mehr automatisch gesetzt.

    Folgender Fehler tritt auf:
    14:02:18.932:-- * --
    14:02:18.932:config.ini exists
    14:02:18.932:retrieving settings from config.ini
    14:02:18.934:file is currently linked to Nelson.vis
    14:02:18.937:[string "(30,3)"]:61: attempt to call a nil value (field 'maxn')
    14:02:18.939:stack traceback:
        [C]: in function 'debugerror'
        [string "function debugfunc(err) debugerror(err) end"]:1: in function 'debugfunc'
        [string "(30,3)"]:61: in function 'read_ini'
        [string "(8,2736)"]:1: in main chunk
    14:02:18.939:Failed to run string in Lua:
    14:02:18.939:String content: read_ini()
    

    Die Zeile 61 sieht folgendermaßen aus:
    for i = 1, table.maxn(t_res) do if line == ("resolution = " .. string.lower( t_res[i] )) then res:setValue(VValueString, t_res[i]); res:setValue(VValueInt, i); print("resolution is currently set to " .. res:getStr(VValueString)) end end
    
    

    Allerdings ist t_res gefüllt, auch wenn ich nur die wichtigsten drei Auflösungen dringelassen habe:
    local t_res = {"Auto","Desktop","1280x720","1366x768","1920x1080"}
    


    Muss ich mindestens die vorgegebenen Auflösungen im Array stehenlassen?

    Danke für die Hilfe.
    Manuel

    Newbie

    100 Posts


  • #2, by afrlmeThursday, 29. November 2018, 14:19 5 years ago
    replace all instances of table.maxn with # instead.

    maxn is deprecated in Lua 5.3.

    for i = 1, #t_res do

    Imperator

    7278 Posts

  • #3, by crankschenkThursday, 29. November 2018, 14:24 5 years ago
    Thanx - it works fine.

    The wiki and the manual seem to be out of date.
    Is it planned to be updated soon?

    Newbie

    100 Posts

  • #4, by sebastianFriday, 30. November 2018, 08:46 5 years ago
    Thanx - it works fine.

    The wiki and the manual seem to be out of date.
    Is it planned to be updated soon?
    regarding lua, try to stick with the luadocs as the goto source.

    Thread Captain

    2346 Posts