Jump to content

useing lua table in function


Go to solution Solved by MrLibya,

Recommended Posts

  • Premium

hallo all

 

i was asking about this :

 

for e.g

 

https://metin2.download/picture/pb3ULsa6HYLfwUcOgwdH2NiPvDMk5JB5/.png

 

https://metin2.download/picture/Q5bcHlzcfifji6660FEFOr6q5znCh4V3/.png

 

https://metin2.download/picture/IUS8jSKicqzdIjBWqY2s6kwx2WY0tQT3/.png

 

the problem is ingame it's says can't find the table !

 

so where i did mistake ?

 

Edited by Metin2 Dev
Core X - External 2 Internal

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

Link to comment
Share on other sites

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

  • 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

  • Premium

same

 

btw to know the error is the table got nil , i said that cant find it i wrong about it sry

https://metin2.download/picture/g0GN2pu5yAtVI7rx5dZu94kQItl3Fn47/.png

Edited by Metin2 Dev
Core X - External 2 Internal

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

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 11

      Metin2 Closed Beta Content (2003-2004)

    2. 11

      Metin2 Closed Beta Content (2003-2004)

    3. 0

      Football Ground

    4. 11

      Metin2 Closed Beta Content (2003-2004)

    5. 0

      Error compile binary Zentoria2

    6. 11

      Metin2 Closed Beta Content (2003-2004)

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

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.