karai17 / Simple-Tiled-Implementation

Tiled library for LÖVE
Other
835 stars 121 forks source link

main:lua attempt to call box2d_init a nil value, why? #269

Closed xor32dotcom closed 2 years ago

xor32dotcom commented 2 years ago

https://stackoverflow.com/questions/72052749/mainlua-attempt-to-call-box2d-init-a-nil-value-why

EDIT: obviously I didnt install the library correctly? (my version of love is 11.4). perhaps i should rename the question to how do i properly install this library. but maybe there are more truths to be found as to what causes this error(i've been stuck at it for 2 days and i can't figure out why the author would just leave this bug out of the open)

the library in question https://github.com/karai17/Simple-Tiled-Implementation/tree/master/sti

i have it on the same directory as my main.lua with the exact same file structure as in the git

local push = require "push" local fsm = require 'statemachine' local sti = require 'sti' function love.load() push:setupScreen(common_res[3][1], common_res[3][2], my_w, my_h, {fullscreen = false}) map = sti("untitled.lua") local layer = map:addCustomLayer("Sprites", 4); local player for k, object in pairs(map.objects) do
if object.name == "player" then
player = object break end end love.physics.setMeter(32); world = love.physics.newWorld(0,0) map:box2d_init(world);

Bobbyjoness commented 2 years ago

When you create the map you should list what plugins you are using sti("map",{"box2d"}) replace "box2d" with the actual plugin name. There should be an example of this working on the love2d forum.

On Fri, Apr 29, 2022, 12:32 AM GabrielReyes136 @.***> wrote:

https://stackoverflow.com/questions/72052749/mainlua-attempt-to-call-box2d-init-a-nil-value-why

EDIT: obviously I didnt install the library correctly? (my version of love is 11.4). perhaps i should rename the question to how do i properly install this library. but maybe there are more truths to be found as to what causes this error(i've been stuck at it for 2 days and i can't figure out why the author would just leave this bug out of the open)

the library in question https://github.com/karai17/Simple-Tiled-Implementation/tree/master/sti

i have it on the same directory as my main.lua with the exact same file structure as in the git

local push = require "push" local fsm = require 'statemachine' local sti = require 'sti' function love.load() push:setupScreen(common_res[3][1], common_res[3][2], my_w, my_h, {fullscreen = false}) map = sti("untitled.lua") local layer = map:addCustomLayer("Sprites", 4); local player for k, object in pairs(map.objects) do if object.name == "player" then player = object break end end love.physics.setMeter(32); world = love.physics.newWorld(0,0) map:box2d_init(world);

— Reply to this email directly, view it on GitHub https://github.com/karai17/Simple-Tiled-Implementation/issues/269, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6IUHVYCL337UOQFQYLIQLVHNQ6LANCNFSM5UUS26XA . You are receiving this because you are subscribed to this thread.Message ID: @.***>