Closed svennd closed 1 year ago
That should allow require usage. Scripts must be placed in app0: partition. Let me know if it works so i can update VPS environment too. eboot_safe.zip
Will try this weekend.
tried, failed. I tried both the 5x and 5.1-5.2 method, they both crash the lpp. I have the dumps but cannot post them here...
Anyway its doable to work around with do() so its totally up to you if you wish to hunt for this bug.
Can you pastebin the exact code you tried? Crashdumps too can be helpful.
Hey Rinny,
I tried these methods : http://lua-users.org/wiki/ModulesTutorial (adapted to vita hello world) the last one was : (there are both methods)
index.lua
mymodule = require("app0:/test.lua")
mymodule.foo()
test.lua
module("mymodule", package.seeall)
function foo()
-- Create a new color
local white = Color.new(255,255,255)
-- Main loop
while true do
-- Draw a string on the screen
Graphics.initBlend()
Screen.clear()
Graphics.debugPrint(5, 5, "Hello World!", white)
Graphics.debugPrint(5, 25, "Press TRIANGLE to return to the sample selector.", white)
Graphics.termBlend()
-- Update screen (For double buffering)
Screen.flip()
-- Check controls for exiting
if Controls.check(Controls.read(), SCE_CTRL_TRIANGLE) then
break
end
end
end
dump : https://ufile.io/ioblf
You must use "test.lua" or "test" and place the script in app0:.
mymodule = require("app0:/test")
mymodule.foo()
this ?
"test.lua" or "test", not "app0:test"...
both crash : https://ufile.io/wo766
According to the crashdump, it's a issue related to vita-libdl: https://github.com/hyln9/vita-libdl/issues/1
Still an issue, I need this dearly for something I'm working on.
Yes, its still open. I hope this can get fixed some day, currently its not possible to load code w/o executing it directly, which is a huge help for keeping code clean. I tried to work around require() with loadfile() but that also does not work.
also load() and the deprecated loadstring() crash it ... seems we have to wait for hyln9 to fix ... :(
This now works with replaced luajit+libdl.
Would it be possible to implement/patch the require() function in lua