Jump to content
  • Advertisement
Sign in to follow this  
derek7

I want number type in lua

This topic is 4617 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

void Lua::tableInStack(lua_State * L , int tableIndex)
{
	lua_pushnil(L);

	// pop nil and put first key/value at step 1
	while(lua_next(L, tableIndex) != 0)
	{
		// value at top and 处理他
		if(lua_isstring(L, -1))
			//printf("%s = %s\n", lua_tostring(L, -2), lua_tostring(L, -1));
			m_strList.push_back( lua_tostring(L, -1));

		else if(lua_isnumber(L, -1))
			//printf("%s = %d\n", lua_tostring(L, -2), lua_tonumber(L, -1));
			m_numList.push_back(lua_tonumber(L, -1));

		else if(lua_istable(L, -1))
			tableInStack(L, tableIndex);

		//pop value , keep key 
		lua_pop(L, 1);
	}
}

==================================here is lua script===================
-- scene descript --
--Mesh "filename" <position> <rotation> "texture"
mesh = {}
mesh["name"] = "filename"
mesh["position"] = {x=01, y=02, z=03}
mesh["rotation"] = {x=02, y=02, z=03, angle=20}
mesh["texture"] = "na"


all variable is string but Is not x=01 number type??

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
You ask about 2-3 questions a day, derek7. Can't you ever think of the answer yourself?

Share this post


Link to post
Share on other sites
Perhaps you should look at the description of the lua_isstring function. Also, perhaps it would have been better for you to have looked at it BEFORE asking here, since it's the obvious place to look.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
You ask about 2-3 questions a day, derek7. Can't you ever think of the answer yourself?


The reason for this is, he always gets the answer since!!

A : The questions arent considered difficult and are mostly technical to the language as opposed to the application

B : He hasnt discovered Google which gives instant answers

C : This forum also consists of his social life

:-)

Have a nice day Derick

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
You ask about 2-3 questions a day, derek7. Can't you ever think of the answer yourself?


The reason for this is, he always gets the answer since!!

A : The questions arent considered difficult and are mostly technical to the language as opposed to the application

B : He hasnt discovered Google which gives instant answers

C : This forum also consists of his social life

:-)

Have a nice day Derick

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!