Jump to content
Alloder.pro  about Allods with love 😱
Search In
  • More options...
Find results that contain...
Find results in...

Servers monitoring and the Addons Editor

We present you two legends. All dreams come true.

Servers monitoring The Addons Editor

Digest April

We talk about what was done and updated in the past month. We help keep abreast of events.

Read more

Game tooltips

Tooltips provide a way for 3rd party fansites and extensions to display detailed information on mouseover.

Read more

Вопрос по userdata


Oberon
 Share

Recommended Posts

Версия игры 4.0.2. Пробую вот такое:

	local id = object.GetBuffs( avatar.GetId() )[ 0 ]
	if id then
		local buffInfo = object.GetBuffInfo( id )
		if buffInfo then
			LogInfo( buffInfo.name )
			LogInfo( buffInfo.description )
		end
	end

Судя по документации, у функции GetBuffInfo( Id ) возвращаемые значения name и description имеют формат WString:

 

name: WString - имя буфа
description: WString - описание буфа
 
но по факту, у меня в LogInfo( ) поле name (как и прочие другие поля этой функции) выводятся нормально, а вот поле description выдает userdata: ...
 
Что такое userdata и как она работает я в общем то понимаю. Но я не понимаю, почему именно description вместо готовых данных в формате WString выдает таки только ссылку на данные, а не конкретно их?
 
Как мне в этом случае получить эти данные: описание бафа, в "читабельном" виде? Где я ошибся?
 
Спасибо,
Edited by Oberon
Link to comment
Share on other sites

common.GetApiType( buffInfo.description )

- расскажет подробно, какая именно это userdata. Есть подозрение, что это ValuedText. И по этой причине глупый LogInfo не может придумать ничего лучше, чем сделать tostring и вывести результат.

  • Upvote 1
Link to comment
Share on other sites

userMods.FromWString()?

WString - это частный случай userdata так-то.

 

Это первое, что я попробовал. выдает ошибку:

Game::LuaUserModsFromWString: param 1 not a class nstl::basic_string<wchar_t> (type: ValuedText), details: int __cdecl Game::LuaUserModsFromWString(struct lua_State *)

Link to comment
Share on other sites

common.GetApiType( buffInfo.description )

- расскажет подробно, какая именно это userdata. Есть подозрение, что это ValuedText. И по этой причине глупый LogInfo не может придумать ничего лучше, чем сделать tostring и вывести результат.

 

все, разобрался. common.ExtractWStringFromValuedText(). спасибо большое,

Edited by Oberon
Link to comment
Share on other sites

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

By using our site you agree to the Terms of Use