Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require() crashes vita #30

Closed
svennd opened this issue Oct 13, 2017 · 13 comments
Closed

require() crashes vita #30

svennd opened this issue Oct 13, 2017 · 13 comments

Comments

@svennd
Copy link
Contributor

svennd commented Oct 13, 2017

Would it be possible to implement/patch the require() function in lua

@Rinnegatamante
Copy link
Owner

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

@svennd
Copy link
Contributor Author

svennd commented Nov 17, 2017

Will try this weekend.

@svennd
Copy link
Contributor Author

svennd commented Nov 17, 2017

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.

@Rinnegatamante
Copy link
Owner

Can you pastebin the exact code you tried? Crashdumps too can be helpful.

@svennd
Copy link
Contributor Author

svennd commented Nov 18, 2017

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

@Rinnegatamante
Copy link
Owner

You must use "test.lua" or "test" and place the script in app0:.

@svennd
Copy link
Contributor Author

svennd commented Nov 18, 2017

mymodule = require("app0:/test")
mymodule.foo()

this ?

@Rinnegatamante
Copy link
Owner

"test.lua" or "test", not "app0:test"...

@svennd
Copy link
Contributor Author

svennd commented Nov 18, 2017

both crash :
https://ufile.io/wo766

@Rinnegatamante
Copy link
Owner

According to the crashdump, it's a issue related to vita-libdl: hyln9/vita-libdl#1

@0x8080
Copy link

0x8080 commented Feb 24, 2018

Still an issue, I need this dearly for something I'm working on.

@svennd
Copy link
Contributor Author

svennd commented Apr 1, 2018

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 ... :(

@Rinnegatamante
Copy link
Owner

This now works with replaced luajit+libdl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants