Yesterday I completed my latest feature and wanted to give it a try on mobile (html5).
Surprisingly, one of my collections was displayed as a black screen. The same thing occurs on desktop (HTML5), so this is not mobile-specific but HTML5-specific.
Notes:
1/ It works 100% fine in Defold.
2/ My previous 100% functional HTML5 build was like 3 weeks ago.
3/ I did not work on this collection since then (or maybe minor stuff).
4/ Same issue on both Defold 1.3.5 and Defold 1.3.6
I tried to identify where the issue could come from by removing big blocks in this collection:
1/ Looks like something’s wrong with the gui used in this scene (after removing it, the scene is loaded again)
2/ Specifically with the gui script (same).
3/ Specifically with in the update() function, because when I delete the content of this function… it loads again. Note sure this is the actual source of the problem, but something happens when I remove that stuff.
So I decided to go deeper into the update() function. And there is where it becomes weird.
I commented all the blocks, one by one, until everything is commented… and the issue remains!!
So…
1/ It “works” (no black screen but useless scene) when the update() function is empty.
2/ It doesn’t work (black screen) when everything in the update() function is commented.
3/ WTF.
MAYBE IMPORTANT:
With Defold 1.3.6 I have more information when building for HTML5 and is here what is displayed in the console:
The output suggests that there’s something wrong with the lua source
It is strange that we don’t output the filename…
Also stranfe that the output comes before locating the LuaBuilderPlugin…
What if you build with bob.jar, and passing the “-v” flag to it? Will it produce more info?
It may be something to do with our update to our LuaBuilder. (ping @britzl)
HTML5 uses vanilla Lua.
Would it be possible for us to have a look at the project? (e.g. share it with us in a DM?)
To be honest, you’re speaking chinese to me
(not sure the expression exists in english but you get the idea)
I could learn how to build with bob.jar (never did it before) but in this case it’d probably be 100 times faster if you investigated yourself directly in the project (cf below).
Yeah sure! I just created a private repo with the latest version of the project.
Can you give me your email(s) or Github names so I can share this repo?
I guess it’s the comment format that is not supported.
By looking at the console of the game, it shows where to look:
ERROR:GUI: Error compiling script: gui/gui_battle_preparation.gui_script:636: nesting of [[...]] is deprecated near '[' dmloader.js:525:40
ERROR:GUI: Error compiling script: gui/gui_battle_preparation.gui_script:636: nesting of [[...]] is deprecated near '[' dmloader.js:525:40
WARNING:RESOURCE: Unable to create resource: /gui/gui_battle_preparation.gui_scriptc: FORMAT_ERROR dmloader.js:524:37
ERROR:GUI: Error compiling script: gui/gui_battle_preparation.gui_script:636: nesting of [[...]] is deprecated near '[' dmloader.js:525:40
WARNING:RESOURCE: Unable to create resource: /gui/gui_battle_preparation.gui_scriptc: FORMAT_ERROR dmloader.js:524:37
WARNING:RESOURCE: Unable to create resource: /_theme-specific/3/gui/g-battle_pvp_async_battle_preparation.guic: FORMAT_ERROR dmloader.js:524:37
ERROR:GUI: Error compiling script: gui/gui_battle_preparation.gui_script:636: nesting of [[...]] is deprecated near '[' dmloader.js:525:40
WARNING:RESOURCE: Unable to create resource: /gui/gui_battle_preparation.gui_scriptc: FORMAT_ERROR dmloader.js:524:37
WARNING:RESOURCE: Unable to create resource: /_theme-specific/3/gui/g-battle_pvp_async_battle_preparation.guic: FORMAT_ERROR dmloader.js:524:37
WARNING:RESOURCE: Unable to create resource: /_generated_8783c3e96f4f9c40.goc: FORMAT_ERROR dmloader.js:524:37
ERROR:GAMEOBJECT: Could not instantiate game object from prototype /_generated_8783c3e96f4f9c40.goc. dmloader.js:525:40
ERROR:GAMEOBJECT: Child not found: /go
In the end, it was your doubly commented code that caused the problem.
It is invalid to do nested block comments like this:
--[[
some code
--[[
some more code
--]]
--]]
Remove the comment and it worked for me.
I’m not sure why it’s not picked up by our LuaBuilder. Perhaps @britzl knows?
No, not really. We pass the code through ANTLR to process it in search for go.property() declarations and require() calls and also to strip out comments, but apparently the Lua grammar definition we use with ANTLR has problems with the nested comments.