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
https://metin2.dev/topic/6493-useing-lua-table-in-function/
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
https://metin2.dev/topic/6493-useing-lua-table-in-function/#findComment-41216
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
https://metin2.dev/topic/6493-useing-lua-table-in-function/#findComment-41231
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
https://metin2.dev/topic/6493-useing-lua-table-in-function/#findComment-41291
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.