Page 4 of 4
RE: UncleBob's annoying API questions
Posted: Sun Jan 08, 2012 3:35 pm
by Brianetta
Expanding on that last:The only Lua scripts that currently create globally scoped objects are the ones in data/libs, and that should probably remain the case. Scripts in that directory are executed before those in data/modules. Ideally, they should provide an API for module scripts to use. That API should be documented by means of the Codedoc system already used by those existing already.The only ones that exist so far are Translate.lua and Characters.lua, the bulk of both of which I wrote myself. Neither of them do anything directly visible to the player. They each provide a class, with methods which the module scripts use.
RE: UncleBob's annoying API questions
Posted: Sun Jan 08, 2012 4:04 pm
by robn
Stuff under libs/ is considered part of the "core" API, just like Body, Ship, StarSystem and all those other things. The only difference is that they're written in Lua instead of C++.If you have functionality that you think will be genuinely useful to multiple scripts, then its likely it belongs in libs/. Don't overthink it though. If you're only implementing one module then just do it there. We can split out that functionality later if its going to be useful.
RE: UncleBob's annoying API questions
Posted: Sun Jan 08, 2012 5:28 pm
by UncleBob
Sounds like it's really the smartest thing to put them together again. I'm not comfortable enough yet with LUA for messing around with core functionality. Thanks for the help.