main.lua 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. release_print( [[
  2. *********************************************
  3. Hello, World, This is Lua. By Launcher
  4. *********************************************
  5. ]])
  6. -- for CCLuaEngine traceback
  7. function __G__TRACKBACK__(msg)
  8. local msgStr = tostring( msg )
  9. local trace = debug.traceback()
  10. release_print("----------------------------------------")
  11. release_print("LUA ERROR: " .. msgStr .. "\n")
  12. release_print(trace)
  13. release_print("----------------------------------------")
  14. -- bugly report
  15. if cc.PLATFORM_OS_ANDROID == global.Platform then
  16. buglyAddUserValue( "LastMVCNotice", tostring( g_lastMVCNotice ) )
  17. if global.BuglyLogs then
  18. for index, value in pairs( global.BuglyLogs ) do
  19. buglyLog( 1, tostring( index ), tostring( value ) )
  20. end
  21. end
  22. buglyReportLuaException( msgStr, trace, false )
  23. else
  24. release_print( "LastMVCNotice:" .. tostring( g_lastMVCNotice ) )
  25. if global.BuglyLogs then
  26. for index, value in pairs( global.BuglyLogs ) do
  27. release_print( tostring( index ) .. ":" .. tostring( value ) )
  28. end
  29. end
  30. end
  31. end
  32. local function loadFilenameLookups()
  33. local filename = "helloWorld.txt"
  34. local fileUtil = cc.FileUtils:getInstance()
  35. if not fileUtil:isFileExist(filename) then
  36. return nil
  37. end
  38. fileUtil:loadFilenameLookup(filename)
  39. end
  40. function requireLauncher(path)
  41. return require( path .. "_launcher" )
  42. end
  43. local function Init()
  44. requireLauncher( "init/init" )
  45. end
  46. local function main()
  47. loadFilenameLookups()
  48. Init()
  49. end
  50. xpcall(main, __G__TRACKBACK__)