Lua programming

Started by
2 comments, last by Sneftel 19 years, 6 months ago
I have a question about lua. I'm considering using lua for a scripting language for a first person shooter bot. I would like to expose some of the bots behavior and events to lua for flexibility. Would it be beneficial for each AI agent to have its own lua state so that they can use different versions of various functions and have their own variables? How would one go about emulating something along these lines? Thanks.
Advertisement
You can do that if you like, but it's usually not worth it, especially since it forces you to replicate the game state across all the Lua states. If you feel like it, you can have each bot running in its own function environment, but IMHO this is usually overkill too. Each bot should be encapsulated in a table, which is sufficient to hold their variables.
Do you have any links to resources that demonstrate this?

Thanks!
Try the Reference Manual. Programming in Lua is also available online.

This topic is closed to new replies.

Advertisement