Elements/prototypes should be enumerable
Elements/prototypes should be enumerable
Either an iterator (not sure if this is possible?) or a method on Entity that exposes the "keys" would be a good idea in the absence of documentation. If it's a method, it'd also be nice to be able to filter the keys so that you only get the ones that are specific to that element.
窮屈そうに身を屈めても今じゃ誰もがそうしてる 天井の無いECHO ROOMに誰かが僕を放り込む
君のSPEEDでもって 同じPHRASEを弾いて 冷たい時に寄り添って
君のSPEEDでもって 同じPHRASEを弾いて 冷たい時に寄り添って
Re: Elements/prototypes should be enumerable
This would be one of the most useful things out there for working with the API as it stands.
At the moment most if you try using pairs to find out about an entity or object in the game, all you get back is __self with a data type of userdata which tells you nothing about the structure of the object or any game things it may expose. It seems that train.schedule works this way at the moment, but nothing else that I have found so far acts similarly.
At the moment most if you try using pairs to find out about an entity or object in the game, all you get back is __self with a data type of userdata which tells you nothing about the structure of the object or any game things it may expose. It seems that train.schedule works this way at the moment, but nothing else that I have found so far acts similarly.
Re: Elements/prototypes should be enumerable
Not exactly the same thing, but try
The help() method should work for any rich lua object.
Code: Select all
game.player.print(game.player.help())
Re: Elements/prototypes should be enumerable
I'll have to give that a try as soon as I get home. With it not being mentioned on the wiki, any I doubt that searching for "help" on the forums would ever give good results so I never even thought to try it.slpwnd wrote:Not exactly the same thing, but try
The help() method should work for any rich lua object.Code: Select all
game.player.print(game.player.help())
If it tells me what I want to know I might be able to really make some headway without having to try and brute force everything by guessing possible method and property names that are not mentioned on the wiki.