lua-users home
lua-l archive

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


On 17/02/2010, at 1:05 PM, Christopher Eykamp wrote:

> I'm working on a C++ game that uses Lua scripts to control robot players.  I'm noticing a common error that the scripters are making, and am looking for a way to detect it and print a helpful error message.
> 
> When the scripters should be writing:
> 
> bot:setAngle(angle)
> 
> they often write:
> 
> bot.setAngle(angle)
> 
> ...
> 
> Is there a way from C++ to figure out if a function was called using "." as opposed to ":"?

Is checking the type of the first argument and then writing "Not enough arguments, you probably used '.' instead of ':'" if it's not a bot good enough?

Cheers,
Geoff