Is there any way to "clear" work space in Lua similar to the clear command in Matlab ?
There's not a built-in function to do that. Offhand, I think the simplest thing to do would be to run through the global environment , setting everything to nil . You'd have to be careful not to nuke any standard libraries you still want to have available, though--library functions are stored in global tables.