Weirdness of the API?
Posted: Sat May 24, 2014 9:25 pm
Am I the only one who finds it weird that you use game.player.methodname(args) instead of game.player:methodname(args) or game.player.methodname(game.player, args)?
Sure, currently it only supports one player, but the same is true for inventories, etc. Is there any reason these things haven't been modeled as objects? It took me quite a while to figure out.
I also wonder why you use game.player.print(s) instead of print(s) to put text into the console. It would probably make sense in a multiplayer environment, but you should be able to simply use print on the "clientside". It makes testing a whole lot easier, since you use print quite a lot when entering lua commands into console.
(Doing a print=game.player.print and then using it crashes the game, does anyone know why?)
Lastly, I've noticed a lot of functions taking a table as single argument instead of arguments.
I realise the API is an early draft and will change in the future, but I wonder how much will be kept and if there are any reasons to define it like this.
Sure, currently it only supports one player, but the same is true for inventories, etc. Is there any reason these things haven't been modeled as objects? It took me quite a while to figure out.
I also wonder why you use game.player.print(s) instead of print(s) to put text into the console. It would probably make sense in a multiplayer environment, but you should be able to simply use print on the "clientside". It makes testing a whole lot easier, since you use print quite a lot when entering lua commands into console.
(Doing a print=game.player.print and then using it crashes the game, does anyone know why?)
Lastly, I've noticed a lot of functions taking a table as single argument instead of arguments.
I realise the API is an early draft and will change in the future, but I wonder how much will be kept and if there are any reasons to define it like this.