Jump to content

DoFile() with Abstract Doesnt Work


Recommended Posts

I would like to pack away the basic Lua classes like base, properties, etc so that the user doesn't have access to them.


I've found that when I do dofile("abstract::base.lua") in the windmill object, it works and loads fine but when I did it in the waterplane entity it didn't work and I received the following error in the Engine.log:


Loading model "d:/source code control/appiled project/current version/models/entities/environment/waterplane/environment_waterplane.gmf"...
Loading mesh "d:/source code control/appiled project/current version/models/entities/environment/waterplane/environment_waterplane.gmf"...
Lua error: cannot open abstract::base.lua: Invalid argument



Is there some way I can make all these dofiles abstract so that I can hide away all the basic Lua files?






2.6 GHz Intel Core Duo - nVidia GeForce 8600 GT - Windows 7 64-bit - 4 Gigs RAM

C++ - Visual Studio Express - Dark GDK - Leadwerks SDK

Link to comment
Share on other sites

dofile(...) is part of the Lua base package. It's not going to recognize any sort of abstract:: protocol. You need to write your own dofile/require/import/etc. routine if you want it to.



local p_dofile = dofile
dofile = function(filename)
	local cap = string.match(filename, "^abstract:.+)")
	return p_dofile((cap and AbstractPath(cap)) or filename)

MacBook Pro 15.4", Intel Core 2 Duo T9600 2.80GHz, 4GB 1066MHz DDR3, GeForce 9400M 256MB, GeForce 9600M GT 512MB - Mac OS 10.6.2, Vista32

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...