Jump to content
  • Advertisement
Sign in to follow this  
Aph3x

LuaPlus: 'type' is a nil value?

This topic is 3988 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
Advertisement
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
Oh dear, am I red-faced.
The Create function source gives a small clue...


LuaState* LuaState::Create(bool initStandardLibrary)



/me hides

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!