lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hey there

To illustrate my confusion:

Imagine an AI agent, the input is a map 20x20 with IDs(player, power
ups, obstacles..) and current HP, the output is a movement to some
tile, and an action:(shoot(requires direction), defend and use power
up...

How to use lua to define this agent decision making code? The only
stupid thing I can think is calling a lua function passing a zillion
of parameters and returning a zillion of weird values on the stack
that are actually keywords + value pairs that the c++ code understands
( i.e. passing an 20x20 array to the stack, the HP, and returning
something like [A, 8, 4, B, up], 'A' being a keyword for movement,
witch is followed by tile x and y, 'B' meaning shoot, followed by a
direction..)

Resuming, I dont know how to modulate the architecture around Lua/c++
to do the stuff I wish to do. Every times I read an article about this
someone throws another Lua OO library at your face..But thats not what
I want, I want to know how to do that with Lua.

- another unrelated question -

When you use Lua as data/config files, can update the data on a .lua
file (using lua library or in lua script itself)?  Lets say you using
a .lua to save the last user video options (resolution, vsync, msaa),
if he changes it, how to update the .lua file? )...