Sign in to follow this  

LuaPlus: 'type' is a nil value?

This topic is 3777 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I got a script that runs fine in basic Lua, but when moving over to LuaPlus it gives the error that the function 'type' is nil (first line of the 'RegisterMod' function). Seeing as the 'type' function is part of the basic Lua lib, I wonder what's gone wrong... is LuaPlus doing something with function environments at a wild guess?!
-- Mods 'namespace' table
Mods =
{
	-- Mod registration table.
	Registry = 
	{
		-- User mods get added here.
	},


	-- Call this fn to register a mod.
	RegisterMod = function(aModInfo)
		if (type(aModInfo) ~= "table") then
			DebugAPI.LogError("Invalid param type to RegisterMod")
			return;
		end		
		if (aModInfo.Name == nil) then
			DebugAPI.LogError("Mod info has no 'Name' entry")
			return;
		end

		table.insert(Mods.Registry, aModInfo)
	end

}


Share this post


Link to post
Share on other sites
Hmmm... seems like *none* of the library functions are available in my function!
The LuaPlus docs say that the Create() function includes the Lua standard library, so am I missing something..?!

Share this post


Link to post
Share on other sites

This topic is 3777 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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