bjornbytes/lovr

on quest2 require does not let to load any lua files

blenderman94 opened this issue · 8 comments

hey lövr docs sazs that other lua files can be loaded i placed next to mz script one and trzed to load a variable but it keeps bothering me with some boolean error. also a gudie on how the moon to compile a module (i mean proper one) will be useful. also if zou culd add luasql to lövr since zou know how to compile it it will be la lifesaver. im stuck on using just one file dont have anz libs so feels like i have to re invent all libs otherwise and squeze them into a single file ^^ thanks for reading even

Hi, did you push the second Lua file onto the Quest? If you have cow.lua in the same folder as main.lua and it contains print('moo'), then you should be able to do require('cow') in your main.lua, just make sure you do adb push --sync . /sdcard/Android/data/org.lovr.app/files. If it's still not working then feel free to provide some more info so we can figure out what's going wrong.

There aren't any plans to add SQL to LÖVR, but someone could make a plugin for it.

im used a file broser like es file explorer and just put it next to as the tutorial says on the website it refuses to require anything i think it looking for some pre compiled libs it makes my program waaaz to long to work on a is single file (also its not clear how to compiled anything for the quest version of this app)

Ok, can you paste the error message you're getting?

the 2 files are next to each other attemting to index upvalue (a boolean value) stack: boot.lua:127 in function boot.lua 108 [c] in function 'xpcall'

local cigany = require('cigany')

function lovr.draw(pass)
pass:text(cigany.sample_text, 0, 1.7, -5)
end

local sample_text="moree hun van ez?"

cigany.lua needs to return something for main.lua to be able to use it:

-- in cigany.lua
return {
  sample_text = '...'
}

so eesentialy i have to return each and every variable ? what about subrutines?

Usually you will do something like this:

local mymodule = {}

mymodule.sample_text = '...'

function mymodule.subroutine()
  -- ...
end

return mymodule

I'm going to close this since this is a general Lua question and not a problem with LÖVR. If you have more questions we can help you out more quickly in the Matrix/Discord chat.

ahh man you saved my arraund 10 k lines to scroll trough each time. santa will bring present to good kids ^^