Sign in to follow this  
l0calh05t

Integrating LUA + PhysFS

Recommended Posts

I did some investigation into this a while back, I don't have my notes on me atm as I'm at work, however I seem to recall that there are a couple of table entries which you can replace which are responcible for loading things in.

I'll see if I can find my notes when I get home.. (having moved house recently I'm not as sure as I once was about the location of such things, heh)

Share this post


Link to post
Share on other sites
Progress report:

I rewrote luaL_loadfile (lauxlib.c) to use PHYSFS, so dofile already works correctly except if a unix shebang line is included (PHYSFS is unbuffered by default and thus I can't put back the last char, although I could do a tell, followed by a seek), but these wouldn't make much sense in this context anyways imo. I might also remove the ability to dofile from stdin (again, makes little sense in this context)

I also changed print (lbaselib.c) to use c++ cout instead of c stdout, because this way I can redirect to any c++ buffer, for example to an ingame console or similar.

The way I see it right now I will have to exclude the package lib, because loading dll/so files through a VFS won't work. (Besides, allowing to load arbitrary lua dll modules, could circumvent the "Sandbox" created by using PhysFS) Too bad "require" will be lost due to this. Maybe I could reimplement require but for .lua and .lub files only.

Rewriting the io lib would be a *lot* of work, but it should be possible. But an easier solution would be nice.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this