Fix sgi-wsapi and sgi-luci to be standards compliant
[project/luci.git] / libs / sgi-wsapi / luasrc / sgi / wsapi.lua
index ebae9fc2778dfeff8bd2fa64364197639c76911e..3b53025990409250c76db8e8c813daaaf2f2d446 100644 (file)
@@ -59,11 +59,14 @@ function run(wsapi_env)
        end
        
        local function iter()
-               local res, id, data1, data2 = coroutine.resume(x)
-               if not res or id == 5 then
+               local res, id, data = coroutine.resume(x)
+               if id == 4 then
+                       return data
+               elseif id == 5 then
+                       return ""
+               end
+               if coroutine.status(x) == "dead" then
                        return nil
-               else
-                       return data1
                end
        end