luaoc.lua 907 B

12345678910111213141516171819202122232425262728
  1. local luaoc = {}
  2. local callStaticMethod = LuaObjcBridge.callStaticMethod
  3. function luaoc.callStaticMethod(className, methodName, args)
  4. local ok, ret = callStaticMethod(className, methodName, args)
  5. if not ok then
  6. local msg = string.format("luaoc.callStaticMethod(\"%s\", \"%s\", \"%s\") - error: [%s] ",
  7. className, methodName, tostring(args), tostring(ret))
  8. if ret == -1 then
  9. print(msg .. "INVALID PARAMETERS")
  10. elseif ret == -2 then
  11. print(msg .. "CLASS NOT FOUND")
  12. elseif ret == -3 then
  13. print(msg .. "METHOD NOT FOUND")
  14. elseif ret == -4 then
  15. print(msg .. "EXCEPTION OCCURRED")
  16. elseif ret == -5 then
  17. print(msg .. "INVALID METHOD SIGNATURE")
  18. else
  19. print(msg .. "UNKNOWN")
  20. end
  21. end
  22. return ok, ret
  23. end
  24. return luaoc