ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Mon Sep 16, 2019 12:33 pm

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Thu Sep 05, 2019 3:29 pm 
Offline
Higher

Joined: Sat Sep 29, 2018 3:43 am
Posts: 63
a good example of the talents whose IDs have colons are inscriptions

This makes addon developpings and debuggings involving these talents annoying. i.e. You can safely type game.player.T_RUSH, but something like game.player.T_INFUSION:_REGENERATION_2 is not going to work.

and I see no downsides of this, except for the efforts to do so.


Top
 Profile  
 
PostPosted: Fri Sep 06, 2019 12:02 am 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 5931
You can bypass it with square brackets instead of the . indexing of tables.

So game.player["T_INFUSION:_REGENERATION_2"] should work.

_________________
My feedback meter decays into coding. Give me feedback and I make mods.


Top
 Profile  
 
PostPosted: Fri Sep 06, 2019 1:35 am 
Offline
Higher

Joined: Sat Sep 29, 2018 3:43 am
Posts: 63
yeah, this works, but what if I'm trying to build such a table in a data file? Using quotations in key seems not working, neither does using colons of course.


Top
 Profile  
 
PostPosted: Fri Sep 06, 2019 7:58 am 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 5931
What are you trying to do that isn't working?
There is no reason that syntax would work in one place, but not in another.

_________________
My feedback meter decays into coding. Give me feedback and I make mods.


Top
 Profile  
 
PostPosted: Fri Sep 06, 2019 11:25 am 
Offline
Higher

Joined: Sat Sep 29, 2018 3:43 am
Posts: 63
I'm trying to write an addon and I want to import a table where some keys are talent IDs from a data file.

plus, when debugging, using [] won't give you auto-complete.


Top
 Profile  
 
PostPosted: Fri Sep 06, 2019 11:46 pm 
Offline
Perspiring Physicist

Joined: Sun Sep 09, 2012 7:43 am
Posts: 5931
Subtly hinting that you should post the code that isn't working...

_________________
My feedback meter decays into coding. Give me feedback and I make mods.


Top
 Profile  
 
PostPosted: Sun Sep 08, 2019 3:24 am 
Offline
Sher'Tul Godslayer

Joined: Thu Jan 23, 2003 8:13 pm
Posts: 1646
Location: A shallow water area south of Bree
helminthauge wrote:
I'm trying to write an addon and I want to import a table where some keys are talent IDs from a data file.

The [] syntax can be used in table indexes too. For instance, here's a fragment from a talent point plan vault file generated by (and designed to be reloaded by) my Talent Point Planner addon:

Code:
wire_version = 3
talents = {
  ["T_VITALITY"] = 1,
  ["T_UNENDING_FRENZY"] = 5,
  ["T_WINDBLADE"] = 1,
  ["T_ACTIVATE_OBJECT_20"] = 1,
  ["T_ACTIVATE_OBJECT_14"] = 1,
  ["T_SECONDARY:_PAIN_SUPPRESSION_1"] = 1,
  ["T_LIGHT_ARMOUR_TRAINING"] = 1,
  ["T_QUICK_RECOVERY"] = 5,

_________________
"Blessed are the yeeks, for they shall inherit Arda..."


Top
 Profile  
 
PostPosted: Fri Sep 13, 2019 4:54 pm 
Offline
Higher

Joined: Sat Sep 29, 2018 3:43 am
Posts: 63
ok, thx Zizzo. seems I'd better actually go to learn Lua


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group