KINGx - Das inoffizielle PlayStation Forum & News Portal

Normale Version: Selbst LUA kennt den Fehler kaum noch!!
Sie sehen gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Also Leute ich hab folgenden Fehler:

Code:
error: [string "?"]:30: bad argument #1 to "ipairs" (table expected, got nil)



srr. noch ma von vorne:

script.lua:

Code:
System.setHigh()
white = Color.new(255,255,255)
blue = Color.new(0,191,255)
black = Color.new(0,0,0)
red = Color.new(255, 0, 0)
green = Color.new(0, 255, 0)
orange = Color.new(235, 115, 0)
yellow = Color.new(255, 255, 0)
gray = Color.new(160, 160, 160)
Bild = Image.load("1.png")

function flashinit()
    System.unassign("flash0:")
    System.sleep(80)
    System.assign("flash0:","lflash0:0,0","flashfat0:")
    System.sleep(80)
        screen:print(1,130,"  Wird installiert/gespeichert...", yellow)
    screen:print(1,140,"...Bitte die PSP nicht ausschalten", yellow)
    screen.flip()
end
function flashfinish()
    screen:print(1,130,"  Assigning ...", yellow)
    screen:print(1,140,"  Flashing ...", yellow)
    screen:print(1,260,"finished", green)
end
function untermenu(farbe)
    counter=0
    while counter<anzahlu do
        counter=counter+1
        screentext=textu[counter]
        if counter==modusu then
            screentext=screentext.." <--"
        end
        screen:print(1,50+(counter*10),screentext,farbe)
    end
    if pad:up() and not oldpad:up() then
        if modusu==1 then
            modusu=anzahlu
        else
            modusu=modusu-1
        end
    end
    if pad:down() and not oldpad:down() then
        if modusu==anzahlu then
            modusu=1
        else
            modusu=modusu+1
        end
    end
    if pad:cross() and not oldpad:cross() then
        funkt[modusu]()
    end
    oldpad = pad
    screen.flip()
    screen.waitVblankStart()
end
function middle(text,y,color)
    screen:print(240-(string.len(text)*8/2),y,text,color)
end
function left(text,y,color)
    screen:print(1,y,text,color)
end
function right(text,y,color)
    screen:print(480-(string.len(text)*8),y,text,color)
end    

while true do
pad = Controls.read()

if System.cfwVersion()=="5.00" and System.getModel(1)=="FAT" then
dofile("ms0:/PSP/GAME/THEME0 saver V3 Revision3/5.00FAT/script.lua")
end

if System.cfwVersion()=="5.50" and System.getModel(1)=="FAT" then
dofile("ms0:/PSP/GAME/THEME0 saver V3 Revision3/5.50FAT/script.lua")
end

if System.cfwVersion()=="5.00" and System.getModel(1)=="SLIM" then
dofile("ms0:/PSP/GAME/THEME0 saver V3 Revision3/5.00SLIM/script.lua")
end

if System.cfwVersion()=="5.50" and System.getModel(1)=="SLIM" then
dofile("ms0:/PSP/GAME/THEME0 saver V3 Revision3/5.50SLIM/script.lua")
end

screen.flip()
screen.waitVblankStart()
screen:blit(0,0,Bild,true)
end

anzahl=table.getn(text)
while true do
screen.flip()
screen:clear(white)
pad = Controls.read()
screen:print(0,0,"Theme0 saver by Notepass und m33",black)
counter=0
while counter<anzahl do
    counter=counter+1
    screentext=text[counter]
    if counter==modus then
        screentext=screentext.." <--"
    end
    screen:print(1,30+(counter*10),screentext,black)
end
-------------------------------------------------------------------------------------------- Modus zu Modus (hoch)
if pad:up() and not oldpad:up() then
    if modus==1 then
        modus=anzahl
    else
        modus=modus-1
    end
end
----------------------------------------------------------------------------------------------- Modus zu Modus (runter)
if pad:down() and not oldpad:down() then
    if modus==anzahl then
        modus=1
    else
        modus=modus+1
    end
end
---------------------------------------------------------------------------------------------------- Weitere Scripte
if pad:cross() and not oldpad:cross() then
    lua[modus]()
end
oldpad = pad
screen.waitVblankStart(0)
end


und main.lua:

Code:
modus = 1
oldpad = Controls.read()
text={"Originales Sony Theme","1. gespeichertes Theme installieren","2. gespeichertes Theme installieren","3. gespeichertes Theme installieren","Theme 1 speichern","Theme 2 speichern","Theme 3 speichern","CFW-Themes anzeigen","Update-Menu","Zu erweitertem Panel wechseln","Exit"}
lua={}
lua[1]=function()
flashinit()
System.copyFile("DATA/opening_plugin.rco","flash0:/vsh/resource/opening_plugin.rco",0)
System.copyFile("DATA/vshmain.prx","flash0:/vsh/module/vshmain.prx",0)
System.copyFile("DATA/ltn0.pgf","flash0:/font/ltn0.pgf",0)
System.copyFile("DATA/gameboot.pmf","flash0:/vsh/resource/gameboot.pmf",0)
System.copyFile("DATA/1.rco","flash0:/vsh/resource/system_plugin_bg.rco",0)
System.message("Erfolgreich installiert",0)
end
lua[2]=function()
flashinit()
System.copyFile("Slot1/opening_plugin.rco","flash0:/vsh/resource/opening_plugin.rco",0)
System.copyFile("Slot1/vshmain.prx","flash0:/vsh/module/vshmain.prx",0)
System.copyFile("Slot1/ltn0.pgf","flash0:/font/ltn0.pgf",0)
System.copyFile("Slot1/gameboot.pmf","flash0:/vsh/resource/gameboot.pmf",0)
System.copyFile("Slot1/1.rco","flash0:/vsh/resource/system_plugin_bg.rco",0)
System.message("Erfolgreich installiert",0)
end
lua[3]=function()
flashinit()
    System.copyFile("Slot2/opening_plugin.rco","flash0:/vsh/resource/opening_plugin.rco",0)
System.copyFile("Slot2/vshmain.prx","flash0:/vsh/module/vshmain.prx",0)
System.copyFile("Slot2/ltn0.pgf","flash0:/font/ltn0.pgf",0)
System.copyFile("Slot2/gameboot.pmf","flash0:/vsh/resource/gameboot.pmf",0)
System.copyFile("Slot2/1.rco","flash0:/vsh/resource/system_plugin_bg.rco",0)
System.message("Erfolgreich installiert",0)
end
lua[4]=function()
flashinit()
   System.copyFile("Slot3/opening_plugin.rco","flash0:/vsh/resource/opening_plugin.rco",0)
System.copyFile("Slot3/vshmain.prx","flash0:/vsh/module/vshmain.prx",0)
System.copyFile("Slot3/ltn0.pgf","flash0:/font/ltn0.pgf",0)
System.copyFile("Slot3/gameboot.pmf","flash0:/vsh/resource/gameboot.pmf",0)
System.copyFile("Slot3/1.rco","flash0:/vsh/resource/system_plugin_bg.rco",0)
System.message("Erfolgreich installiert",0)
end
lua[5]=function()
flashinit()
System.copyFile("flash0:/vsh/resource/opening_plugin.rco","Slot1/opening_plugin.rco",0)
System.copyFile("flash0:/vsh/module/vshmain.prx","Slot1/vshmain.prx",0)
System.copyFile("flash0:/font/ltn0.pgf","Slot1/ltn0.pgf",0)
System.copyFile("flash0:/vsh/resource/gameboot.pmf","Slot1/gameboot.pmf",0)
System.copyFile("flash0:/vsh/resource/system_plugin_bg.rco","Slot1/1.rco",0)
System.message("Erfolgreich Gespeichert",0)
end
lua[6]=function()
flashinit()
   System.copyFile("flash0:/vsh/resource/opening_plugin.rco","Slot2/opening_plugin.rco",0)
System.copyFile("flash0:/vsh/module/vshmain.prx","Slot2/vshmain.prx",0)
System.copyFile("flash0:/font/ltn0.pgf","Slot2/ltn0.pgf",0)
System.copyFile("flash0:/vsh/resource/gameboot.pmf","Slot2/gameboot.pmf",0)
System.copyFile("flash0:/vsh/resource/system_plugin_bg.rco","Slot2/1.rco",0)
System.message("Erfolgreich Gespeichert",0)
end
lua[7]=function()
flashinit()
  System.copyFile("flash0:/vsh/resource/opening_plugin.rco","Slot3/opening_plugin.rco",0)
System.copyFile("flash0:/vsh/module/vshmain.prx","Slot3/vshmain.prx",0)
System.copyFile("flash0:/font/ltn0.pgf","Slot3/ltn0.pgf",0)
System.copyFile("flash0:/vsh/resource/gameboot.pmf","Slot3/gameboot.pmf",0)
System.copyFile("flash0:/vsh/resource/system_plugin_bg.rco","Slot3/1.rco",0)
System.message("Erfolgreich Gespeichert",0)
end
lua[8]=function()
dofile("CWT.lua")
end
lua[9]=function()
dofile("update-menu.lua")
end
lua[10]=function()
dofile("MAIN2.lua")
end
lua[11]=function()
   System.Quit()
   end

anzahl=table.getn(text)
while true do
screen.flip()
screen:clear(white)
pad = Controls.read()
screen:print(0,0,"Theme0 saver by Notepass und m33",black)
counter=0
while counter<anzahl do
    counter=counter+1
    screentext=text[counter]
    if counter==modus then
        screentext=screentext.." <--"
    end
    screen:print(1,30+(counter*10),screentext,black)
end
-------------------------------------------------------------------------------------------- Modus zu Modus (hoch)
if pad:up() and not oldpad:up() then
    if modus==1 then
        modus=anzahl
    else
        modus=modus-1
    end
end
----------------------------------------------------------------------------------------------- Modus zu Modus (runter)
if pad:down() and not oldpad:down() then
    if modus==anzahl then
        modus=1
    else
        modus=modus+1
    end
end
---------------------------------------------------------------------------------------------------- Weitere Scripte
if pad:cross() and not oldpad:cross() then
    lua[modus]()
end
oldpad = pad
screen.waitVblankStart(0)
end


Ich find den fehler net kann mir einer helfen??

screentext=textu[counter]

die tabelle "textu" hast du aber schon in einem anderen script erstellt?
ähh was wie???
srr. von tablen hab ich kaum plan die hab ich von m33

Zitat:
error: [string "?"]:30: bad argument #1 to "ipairs" (table expected, got nil)

In dieser Zeile ist der Fehler.

Code:
screentext=textu[counter]

Er erwartet (expect) eine Tabelle (table) und hat NULL (nichts, '0') bekommen.
Probier mal:
screentext = textu{counter}

Kann aber nicht versprechen, dass es geht. Ich hasse Lua nämlich Big Grin

nope hilftnet heul
seit wann ist denn der fehler? ich meine was GENAU hast du vorher verändert?
moment ich suche den alten code raus...

EDIT:
Hier:

main.lua

Code:
modus = 1
oldpad = Controls.read()
text={"Originales Sony Theme","1. gespeichertes Theme installieren","2. gespeichertes Theme installieren","3. gespeichertes Theme installieren","Theme 1 speichern","Theme 2 speichern","Theme 3 speichern","CWT anzeigen","Exit"}
lua={}
lua[1]=function()
flashinit()
System.copyFile("DATA/opening_plugin.rco","flash0:/vsh/resource/opening_plugin.rco",0)
System.copyFile("DATA/vshmain.prx","flash0:/vsh/module/vshmain.prx",0)
System.copyFile("DATA/ltn0.pgf","flash0:/font/ltn0.pgf",0)
System.copyFile("DATA/gameboot.pmf","flash0:/vsh/resource/gameboot.pmf",0)
System.copyFile("DATA/1.rco","flash0:/vsh/resource/system_plugin_bg.rco",0)
System.message("Erfolgreich installiert",0)
end
lua[2]=function()
flashinit()
System.copyFile("Slot1/opening_plugin.rco","flash0:/vsh/resource/opening_plugin.rco",0)
System.copyFile("Slot1/vshmain.prx","flash0:/vsh/module/vshmain.prx",0)
System.copyFile("Slot1/ltn0.pgf","flash0:/font/ltn0.pgf",0)
System.copyFile("Slot1/gameboot.pmf","flash0:/vsh/resource/gameboot.pmf",0)
System.copyFile("Slot1/1.rco","flash0:/vsh/resource/system_plugin_bg.rco",0)
System.message("Erfolgreich installiert",0)
end
lua[3]=function()
flashinit()
    System.copyFile("Slot2/opening_plugin.rco","flash0:/vsh/resource/opening_plugin.rco",0)
System.copyFile("Slot2/vshmain.prx","flash0:/vsh/module/vshmain.prx",0)
System.copyFile("Slot2/ltn0.pgf","flash0:/font/ltn0.pgf",0)
System.copyFile("Slot2/gameboot.pmf","flash0:/vsh/resource/gameboot.pmf",0)
System.copyFile("Slot2/1.rco","flash0:/vsh/resource/system_plugin_bg.rco",0)
System.message("Erfolgreich installiert",0)
end
lua[4]=function()
flashinit()
   System.copyFile("Slot3/opening_plugin.rco","flash0:/vsh/resource/opening_plugin.rco",0)
System.copyFile("Slot3/vshmain.prx","flash0:/vsh/module/vshmain.prx",0)
System.copyFile("Slot3/ltn0.pgf","flash0:/font/ltn0.pgf",0)
System.copyFile("Slot3/gameboot.pmf","flash0:/vsh/resource/gameboot.pmf",0)
System.copyFile("Slot3/1.rco","flash0:/vsh/resource/system_plugin_bg.rco",0)
System.message("Erfolgreich installiert",0)
end
lua[5]=function()
flashinit()
System.copyFile("flash0:/vsh/resource/opening_plugin.rco","Slot1/opening_plugin.rco",0)
System.copyFile("flash0:/vsh/module/vshmain.prx","Slot1/vshmain.prx",0)
System.copyFile("flash0:/font/ltn0.pgf","Slot1/ltn0.pgf",0)
System.copyFile("flash0:/vsh/resource/gameboot.pmf","Slot1/gameboot.pmf",0)
System.copyFile("flash0:/vsh/resource/system_plugin_bg.rco","Slot1/1.rco",0)
System.message("Erfolgreich Gespeichert",0)
end
lua[6]=function()
flashinit()
   System.copyFile("flash0:/vsh/resource/opening_plugin.rco","Slot2/opening_plugin.rco",0)
System.copyFile("flash0:/vsh/module/vshmain.prx","Slot2/vshmain.prx",0)
System.copyFile("flash0:/font/ltn0.pgf","Slot2/ltn0.pgf",0)
System.copyFile("flash0:/vsh/resource/gameboot.pmf","Slot2/gameboot.pmf",0)
System.copyFile("flash0:/vsh/resource/system_plugin_bg.rco","Slot2/1.rco",0)
System.message("Erfolgreich Gespeichert",0)
end
lua[7]=function()
flashinit()
  System.copyFile("flash0:/vsh/resource/opening_plugin.rco","Slot3/opening_plugin.rco",0)
System.copyFile("flash0:/vsh/module/vshmain.prx","Slot3/vshmain.prx",0)
System.copyFile("flash0:/font/ltn0.pgf","Slot3/ltn0.pgf",0)
System.copyFile("flash0:/vsh/resource/gameboot.pmf","Slot3/gameboot.pmf",0)
System.copyFile("flash0:/vsh/resource/system_plugin_bg.rco","Slot3/1.rco",0)
System.message("Erfolgreich Gespeichert",0)
end
lua[8]=function()
dofile("CWT.lua")
end
lua[9]=function()
   System.Quit()
   end

anzahl=table.getn(text)
while true do
screen.flip()
screen:blit(0,0,Bild,true)
pad = Controls.read()
screen:print(0,0,"Theme0 saver by Notepass und m33",black)
counter=0
while counter&lt;anzahl do
    counter=counter+1
    screentext=text[counter]
    if counter==modus then
        screentext=screentext.." &lt;--"
    end
    screen:print(1,30+(counter*10),screentext,black)
end
-------------------------------------------------------------------------------- ------------ Modus zu Modus (hoch)
if pad:up() and not oldpad:up() then
    if modus==1 then
        modus=anzahl
    else
        modus=modus-1
    end
end
-------------------------------------------------------------------------------- --------------- Modus zu Modus (runter)
if pad:down() and not oldpad:down() then
    if modus==anzahl then
        modus=1
    else
        modus=modus+1
    end
end
-------------------------------------------------------------------------------- -------------------- Weitere Scripte
if pad:cross() and not oldpad:cross() then
    lua[modus]()
end
oldpad = pad
screen.waitVblankStart(0)
end



script.lua:

Code:
System.setHigh()
white = Color.new(255,255,255)
blue = Color.new(0,191,255)
black = Color.new(0,0,0)
red = Color.new(255, 0, 0)
green = Color.new(0, 255, 0)
orange = Color.new(235, 115, 0)
yellow = Color.new(255, 255, 0)
gray = Color.new(160, 160, 160)
Bild = Image.load("1.png")

function flashinit()
    System.unassign("flash0:")
    System.sleep(80)
    System.assign("flash0:","lflash0:0,0","flashfat0:")
    System.sleep(80)
        screen:print(1,130,"  Wird installiert/gespeichert...", yellow)
    screen:print(1,140,"...Bitte die PSP nicht ausschalten", yellow)
    screen.flip()
end
function flashfinish()
    screen:print(1,130,"  Assigning ...", yellow)
    screen:print(1,140,"  Flashing ...", yellow)
    screen:print(1,260,"finished", green)
end
function untermenu(farbe)
    counter=0
    while counter&lt;anzahlu do
        counter=counter+1
        screentext=textu[counter]
        if counter==modusu then
            screentext=screentext.." &lt;--"
        end
        screen:print(1,50+(counter*10),screentext,farbe)
    end
    if pad:up() and not oldpad:up() then
        if modusu==1 then
            modusu=anzahlu
        else
            modusu=modusu-1
        end
    end
    if pad:down() and not oldpad:down() then
        if modusu==anzahlu then
            modusu=1
        else
            modusu=modusu+1
        end
    end
    if pad:cross() and not oldpad:cross() then
        funkt[modusu]()
    end
    oldpad = pad
    screen.flip()
    screen.waitVblankStart()
end
function middle(text,y,color)
    screen:print(240-(string.len(text)*8/2),y,text,color)
end
function left(text,y,color)
    screen:print(1,y,text,color)
end
function right(text,y,color)
    screen:print(480-(string.len(text)*8),y,text,color)
end    

while true do
screen:print(1,50,"Theme0 saver by Notepass und m33",white)
screen:print(1,60,"Achtung: Nur auf einer festen CFW benutzen!!",red)
screen:print(1,70,"Ich bin fur keine schaden an deiner PSP verantwortlich!!",red)
screen:print(1,80,"Druecke X um das Normale Benutzer Panal zu offnen",white)
screen:print(1,90,"Druecke O um das erweiterte Panal zu offnen",white)
pad = Controls.read()
if pad:cross() and System.cfwVersion()=="5.00" and System.getModel(1)=="SLIM" then
dofile("main.lua")
end
if pad:circle() and System.cfwVersion()=="5.00" and System.getModel(1)=="SLIM" then
dofile("main2.lua")
end

if pad:cross() and System.cfwVersion()=="5.00" and System.getModel(2)=="1000" then
dofile("ms0:/PSP/GAME/THEME0 saver V3 Revision2/5.00FAT/main.lua")
end
if pad:circle() and System.cfwVersion()=="5.00" and System.getModel(3)=="1000" then
dofile("ms0:/PSP/GAME/THEME0 saver V3 Revision2/5.00FAT/main2.lua")
end

if pad:cross() and System.cfwVersion()=="5.50" and System.getModel(1)=="FAT" then
dofile("ms0:/PSP/GAME/THEME0 saver V3 Revision2/5.50FAT/main.lua")
end
if pad:circle() and System.cfwVersion()=="5.50" and System.getModel(1)=="FAT" then
dofile("ms0:/PSP/GAME/THEME0 saver V3 Revision2/5.50FAT/main2.lua")
end

if pad:cross() and System.cfwVersion()=="5.50" and System.getModel(1)=="SLIM" then
dofile("ms0:/PSP/GAME/THEME0 saver V3 Revision2/5.50SLIM/main.lua")
end
if pad:circle() and System.cfwVersion()=="5.50" and System.getModel(1)=="SLIM" then
dofile("ms0:/PSP/GAME/THEME0 saver V3 Revision2/5.50SLIM/main2.lua")
end
if system.getmodel(2)=="3000" then
System.message("Dieses modell wird nicht unterstutzt!!",0)
end

screen.flip()
screen.waitVblankStart()
screen:blit(0,0,Bild,true)
end

Er erwartet ein Datenfeld textu[xyz]

XYZ = Array

Unbekannt :
Er erwartet ein Datenfeld textu[xyz]

XYZ = Array

???

Wie soll ich das anstellen??

kein bock alles zu lesen, sag mir pls die änderungen
@Notepass: k.A wie man Datenfelder in Lua macht.

counter = {XYZ}

Neutrosider :
kein bock alles zu lesen, sag mir pls die änderungen


Na super...
Also:
Die script.lua hat nun nur noch die Dateien die für das Programm geladen werden müssen (also flashinit un so) und sotirt jetzt die PSP´s auseinander also z.b: PSP 2000 5.00 wird auf die Datei script500slim.lua weitergeleited anstelle davon das wie vorher X oder O gedrükt werden müssen!!

Main.lua:
Nur leichte abänderung, da ich das Ordnersystem geändet hab für dei 5.00 Slim´s
Also bei 5.00 slim en anderer Pfaad
und es is ab jetzt so, dass man den webbrowser damit öffnet und die Datei Main2.lua sowie die datei update.lua öffnen kann

Ich glaub das wars Big Grin

screentext=textu[counter] passt schon.

er muss aber vorher schonmal die tabelle erstellt haben:
textu={}
textu[1]="LOL"
textu[2]="wtf lOOL"

So wie in deiner main.lua:

Lua = {}
Lua[1] = function()
Lua[2] = ...
..
es geht doch garnicht um diese zeile, merkt ihr das nicht?

er hatte vorher einen funktionierenden code, in welcher diese Zeile ebenfalls vorkommt. die änderungen sind wichtig.

textu muss vermutlich eine string-table sein, also etwa so ein format haben (auch wenns so nicht im text steht):
textu={"String1","String2","String3"...)

ich vermute dass er im neuen Code textu mit was anderem als einer String-Table überschrieben hat, daher will ich genau die ändergunen zwischen altem und neuen code wissen

Chagano :
screentext=textu[counter] passt schon.

er muss aber vorher schonmal die tabelle erstellt haben:
textu={}
textu[1]="LOL"
textu[2]="wtf lOOL"

So wie in deiner main.lua:

Lua = {}
Lua[1] = function()
Lua[2] = ...
..


Leute könntet ihr euch bitte en bissn eher so ausdrüken, dass auch ich das verstehe
Wie gesagt ich hab von table null plan!!

EDIT:
Habs gerafft!!
Is aber doch alles drine

Seiten: 1 2
Referenz-URLs