Jump to content
×
×
  • Create New...
  • 0

useing lua table in function


MrLibya

Question

9 answers to this question

Recommended Posts

  • 0
  • Moon

Are you using this function in quest or are you calling this function from questlib.lua?

 

questlib.lua ;

local pc = pc or {}

function pc.chat(text)
	print(text)
end

quest :

quest test begin
	state start begin
		function chat(text)
			syschat(text)
		end
		when 9001.chat."Test me" begin
			setskin(NOWINDOW)
			test.chat("Mrlibya")
		end
	end
end

- How can you check your function is work or not? It's too simple. You can put breakpoint. So you can do like that ;

function get_attr_armor_table()
	if (attr_wizerd.attr_armor_info != nil) then
		chat("attr_wizerd.attr_armor_info is not nil.")
		return attr_wizerd.attr_armor_info
	else
		chat("attr_wizerd.attr_armor_info is nil.")
		return 0
	end
	return 0
end

Kind Regards

Ken

Edited by Ken
  • Love 1

Do not be sorry, be better.

Link to comment
Share on other sites

  • 0
  • Premium

Are you using this function in quest or are you calling this function from questlib.lua?

 

questlib.lua ;

local pc = pc or {}

function pc.chat(text)
	print(text)
end

quest :

quest test begin
	state start begin
		function chat(text)
			syschat(text)
		end
		when 9001.chat."Test me" begin
			setskin(NOWINDOW)
			test.chat("Mrlibya")
		end
	end
end

- How can you check your function is work or not? It's too simple. You can put breakpoint. So you can do like that ;

function get_attr_armor_table()
	if (attr_wizerd.attr_armor_info != nil) then
		chat("attr_wizerd.attr_armor_info is not nil.")
		return attr_wizerd.attr_armor_info
	else
		chat("attr_wizerd.attr_armor_info is nil.")
		return 0
	end
	return 0
end

Kind Regards

Ken

iam useing it for quest , the problem is ingame it's not show the table and says error : can't find table data_table01

If you're going to do something, then do it right.

Link to comment
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


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.