TannerRogalsky / love.js

LÖVE ported to the web using Emscripten
MIT License
493 stars 53 forks source link

Attempt to call nil value #49

Closed egordorichev closed 7 years ago

egordorichev commented 7 years ago

Was testing your awesome framework before game jam, packed my game to a zip file. Did all, that is in README. All worked fine. Besides, the lua:

Game can be found here

Tryed to pass folder with game. Same result. How to fix? Thanks.

TannerRogalsky commented 7 years ago

There's a Lua error in your code AKA you're doing something unsupported by the web version. Maybe lurker? That lib is really intrusive and you shouldn't use it in your release version anyway.

I'd just remove things from your game until it works.

egordorichev commented 7 years ago

Oh, lurker.... Ok, will try to remove it. Thanks.

egordorichev commented 7 years ago

Hey! I've created new empty lua app:

function love.draw()
    love.graphics.print("Hello!", 10, 10)
end

Packed it into game.zip. Love can run it. I'm packing it with this command:

python2.7 ../emscripten/tools/file_packager.py game.data --preload game.zip@/ --js-output=game.js

(Game is in debug folder)

Running server:

python2.7 -m SimpleHTTPServer 8000

I'm missing something?

screenshot_2017-06-11_16-49-08

TannerRogalsky commented 7 years ago

That invocation of file_packager is probably not what you want. --preload game.zip@/ loads game.zip at the root directory of emscripten's in-memory file system.

If you want to use a .zip, run --preload game.zip@/game.zip and then change the arguments field on the Module object in the html page to ['./game.zip'] to tell the application where the game data is.

egordorichev commented 7 years ago

var Module = { preRun: [], postRun: [], arguments: ['./game.zip'],

And

python2.7 ../emscripten/tools/file_packager.py game.data --preload game.zip@/game.zip --js-output=game.js

Same result.

egordorichev commented 7 years ago

Oh, I found this: https://www.npmjs.com/package/love.js Will try it out.