About Simple Tiled Implementation (sti) - lua

so I'm trying to import a tiled map into my game and gives me this error:
libraries/sti/utils.lua:195: Could not open file ../path/to/my/gamesheet/file. Does not exist.
so if you know the answer, let me know
Additional Errors:
stack traceback:
[love "boot.lua"]:345: in function <[love "boot.lua"]:341>
[C]: in function 'newImageData'
libraries/sti/utils.lua:195: in function 'fix_transparent_color'
libraries/sti/init.lua:106: in function 'init'
libraries/sti/init.lua:48: in function 'sti'
main.lua:7: in function 'load'
[love "callbacks.lua"]:136: in function <[love "callbacks.lua"]:135>
[C]: in function 'xpcall'
[love "boot.lua"]:361: in function <[love "boot.lua"]:348>
[C]: in function 'xpcall'
[Finished in 77.8s]

(I found out hot fix it) Answer:
In the lua file where you exported your tiled project, where it says "image" and it has a directory to the image, replace it with the name of your sprite sheet, but your gonna have to put the sprite sheet in the same directory as the tiled map

Related

using a batch file to open lua love is giving error

I just started learning love and I've tried opening love with a batch file, while it does open it gives this error
Error
[love "boot.lua"]:321: No code to run
Your game might be packaged incorrectly.
Make sure main.lua is at the top level of the zip.
Traceback
[love "callbacks.lua"]:228: in function 'handler'
[C]: in function 'error'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
however when dragging the whole folder inside of love it works perfectly, does somebody know how can I fix this?
Error message
Error message indicates, that you did not set correct path to your code, so the is no code to run. It should be folder containing main.lua
Simple batch file
Place the following code to file start.bat:
#ECHO OFF
"C:\Program Files\LOVE\love.exe" "C:\path\to\game\folder"
(replace C:\path\to\game\folder with actual path to folder containing main.lua and if you have love.exe elsewhere, also replace it to the correct path)
And then, you can run your code by double-clicking the start.bat file
Some helpful links:
How to run your game
Batch file example

How to add a Lua library on VS

So I am a beginner in programming and I decided to learn Lua. I am adding a library to Lua (push: require 'push') but I am getting this error when I am running it on LOVE2D. What should I do?
Error
main.lua:1: module 'push' not found:
no field package.preload['push']
no 'push' in LOVE game directories.
no file 'push' in LOVE paths.
no file './push.lua'
no file '/usr/local/share/luajit-2.1.0-beta3/push.lua'
no file '/usr/local/share/lua/5.1/push.lua'
no file '/usr/local/share/lua/5.1/push/init.lua'
no file './push.so'
no file '/usr/local/lib/lua/5.1/push.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
Traceback
[love "callbacks.lua"]:228: in function 'handler'
[C]: in function 'require'
main.lua:1: in main chunk
[C]: in function 'require'
[C]: in function 'xpcall'
[C]: in function 'xpcall'

'end' expected near '<eof>' for map import for lua file

Error
Syntax error: main.lua:8: 'end' expected (to close 'function' at line 5) near '<eof>'
Traceback
[love "callbacks.lua"]:228: in function 'handler'
[C]: at 0x010558a810
[C]: in function 'require'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
I am getting the above error when I am trying to import a game map for my love2D game.
My code is below:
function love.load()
sti = require'lib/sti'
gameMap = sti('Maps/test_map.lua')
end
function love.draw()
gameMap:draw()
end
sti is a library which I am using to get the map into love. I learnt this from a youtube tutorial.
try looking at the function gameMap:draw, you might have forgotten an end on it

Basic Quit Function in LOVE2D

I started using LOVE yesterday and I'm trying to code a basic quit function with LUA.
Here's my code
if function love.keyboard.getKey("q")
function love.event.quit()
end
I've tried it with and without the functions.
When I run it, it gives me this error
Error
Syntax error: main.lua:1: '(' expected near 'love'
Traceback
[C]: at 0x7ff9037828f0
[C]: in function 'require'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
if function love.keyboard.getKey("q")
function love.event.quit()
end
Is invalid Lua syntax.
function is a keyword that is used to define function value. It is not part of the if statement and not used in function calls.
an if statement looks like
if condition then
-- block
end
love.keyboard.getKey("q") is not part of the love2d API.
What you want to do would probably be achieved by implementing a keypressed event handler.
Computer programs are not written by guessing some syntax and then asking for help.
Do a tutorial and read the Lua manual if you want to do anything useful with Lua.

Got `internal error in __sub: no metatable` error in Lua and Torch

I tried to create a image-to-image model by pix2pix (https://github.com/phillipi/pix2pix) and followed Getting Started instruction.
Then, downloaded facades dataset by bash ./datasets/download_dataset.sh facades
and run DATA_ROOT=./datasets/facades name=facades_generation which_direction=BtoA th train.lua
but I got the following error.
~/torch-cl/install/bin/luajit: ./models.lua:69: internal error in
__sub: no metatable stack traceback: [C]: in function '__sub' ./models.lua:69: in function 'defineG_unet' train.lua:110: in
function 'defineG' train.lua:146: in main chunk [C]: in function
'dofile'
...i/torch-cl/install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in
main chunk [C]: at 0x010ec81ce0
Does anyone know how I can fix this?
I'm new to Lua and Torch, so have no idea how to fix this.
Thank you
this is run on Mac OSX
python2.7

Resources