I am using dataSaver in my project. Everything works fine in the local player (Windows). When I export to HTML and then upload the resulting folder to a web server, I get the following error when accessing it.
classes/dataSaver.lua:4: module 'json' not found:
no field package.preload['json']
no file './json.lua'
no file './json/init.lua'
no file './_LuaPlugins_/json.lua'
no file './_LuaPlugins_/json/init.lua'
no file '/usr/local/share/lua/5.1/json.lua'
no file '/usr/local/share/lua/5.1/json/init.lua'
no file '/usr/local/lib/lua/5.1/json.lua'
no file '/usr/local/lib/lua/5.1/json/init.lua'
no file './json.so'
no file '/usr/local/lib/lua/5.1/json.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
classes/dataSaver.lua:4: in main chunk
(luac): in main chunk |
dataSaver looks like this
if not json then
require "json"
end |
Obviously it's missing a json package. I am not sure how modules, plugins, packages work together on desktop or in export.
some magic helps dataSaver find json on desktop, but that magic is not included on export.
Here are some things I tried.
1) find json.lua, download it and put it with my classes. This seems similar to how scenemanager.lua works, I have scenemanager.lua as a local .lua file with my classes. But json.lua seems to work differently. I tried with and without marking it "exclude from Execution". I also tried depending on it, or have dataSaver.lua depend on
2) Add the standard JSON plug-in. That didn't work either. Just for fun, I removed scenemanager.lua from my directory and used the standard plugin. That worked on desktop, but not through HTML export. So I couldn't get plugins in general to work through HTML.
I like the local file route, as I am still learning, and I don't understand plugins.
However, the plugin route seems feasible, too, and both JSON and SceneManager have an HTML icon, so should support HTML. I should probably switch to a plugin for dataSaver, too.
The project file is below (marking as code didn't show it, so had to use the pre-tag)
<project>
<properties html5_crash="" build_number="1" autorotation="0" touchToMouse="1" splashScaleMode="0" app_name="Bushido Battle" logicalHeight="1920" packageName="com.yourdomain.yourapp" html5_pack="0" splash_h_image="" html5_fbload="100" logicalWidth="1200" winrt_package="com.yourdomain.yourapp" mouseTouchOrder="0" windowHeight="0" iosDevice="0" tv_icon="" retinaDisplay="0" architecture="7" win_domain="giderosmobile.com" encryptCode="0" orientation="1" html5_symbols="0" app_icon="" html5_wasm="0" osx_signingId="" exportMode="0" fps="60" splash_v_image="" osx_category="5" vsync="0" html5_mem="256" android_template="0" version_code="1" backgroundColor="#ffffff" ios_bundle="com.yourdomain." encryptAssets="0" osx_installerId="" windowWidth="0" version="1.0" winrt_org="GiderosMobile" html5_fbinstant="0" osx_org="GiderosMobile" mouseToTouch="1" osx_bundle="com.yourdomain." win_org="GiderosMobile" disableSplash="0" osx_domain="giderosmobile.com" html5_host="" scaleMode="3">
<imageScales/>
</properties>
<folder name="classes">
<file name="assets/classes/Button.lua"/>
<file name="assets/classes/Character.lua"/>
<file name="assets/classes/Constants.lua"/>
<file name="assets/classes/MainScreen.lua"/>
<file name="assets/classes/Messages.lua"/>
<file name="assets/classes/Monsters.lua"/>
<file name="assets/classes/Player.lua"/>
<file name="assets/classes/SceneDeath.lua"/>
<file name="assets/classes/SceneLobby.lua"/>
<file name="assets/classes/ScenePlay.lua"/>
<file name="assets/classes/SceneStart.lua"/>
<file name="assets/classes/SceneVictory.lua"/>
<file name="assets/classes/Sounds.lua"/>
<file name="assets/classes/Start.lua"/>
<file name="assets/classes/TileMap.lua"/>
<file name="assets/classes/dataSaver.lua"/>
<file name="assets/classes/scenemanager.lua"/>
</folder>
<folder name="fonts">
<file name="assets/fonts/IMMORTAL.ttf"/>
<file name="assets/fonts/immortal_XL.png"/>
<file name="assets/fonts/immortal_XL.txt"/>
<file name="assets/fonts/immortal_large.png"/>
<file name="assets/fonts/immortal_large.txt"/>
<file name="assets/fonts/immortal_medium.png"/>
<file name="assets/fonts/immortal_medium.txt"/>
<file name="assets/fonts/immortal_small.png"/>
<file name="assets/fonts/immortal_small.txt"/>
</folder>
<folder name="images">
<file name="assets/images/foreground.png"/>
<file name="assets/images/tileset-environment-108px.png"/>
<file name="assets/images/tileset-health-108px.png"/>
<file name="assets/images/tileset-light-108px.png"/>
<file name="assets/images/tileset-monsters-108px.png"/>
<file name="assets/images/tileset-terrain-108px.png"/>
</folder>
<folder name="sounds">
<file name="assets/sounds/footsteps-02.wav"/>
<file name="assets/sounds/footsteps-03.wav"/>
<file name="assets/sounds/footsteps-fast.wav"/>
<file name="assets/sounds/footsteps-light.wav"/>
<file name="assets/sounds/footsteps-one.wav"/>
<file name="assets/sounds/melee_hit.mp3"/>
<file name="assets/sounds/melee_hit.wav"/>
<file name="assets/sounds/melee_hit2.wav"/>
<file name="assets/sounds/melee_miss.mp3"/>
<file name="assets/sounds/music-death.mp3"/>
<file name="assets/sounds/music-title.mp3"/>
<file name="assets/sounds/music-victory.mp3"/>
</folder>
<file source="main.lua"/>
<dependency to="assets/classes/Constants.lua" from="assets/classes/Character.lua"/>
<dependency to="assets/classes/Constants.lua" from="main.lua"/>
<dependency to="assets/classes/scenemanager.lua" from="main.lua"/>
</project> |
Comments
https://deluxepixel.com
Export adds a json.wasm file to the folder, but it still is not found when trying to run.
.gproj now has
I restored the old folders from the trash and still have them. Is it helpful to you if I try if I can reproduce it and get console logs?