Skip to main content
GameDev.net gamedev.net
🔒 Locked

Game world initialization from Lua

Started by overeasy Jun 2, 2010 at 3:53 PM 1 replies 1.1k views
Original Post
overeasy
overeasy
What is the correct way to pass objects to script files,
ie implement this pseudo code:

lua.do_file("script_file.lua", Map parameter, Object otherparameters);

My guess: I would have make a LuaMap object type that is usable by Lua, and convert my Map object to a LuaMap and throw it on a stack before executing the script file? I am only just getting into scripting.

MANY THANKS
overeasy
overeasy
I want to move this code

				Actor* a;				for(int i = 0; i < 4; i++){					a = new Actor(rand() % map->numRows(), rand() % map->numCols());					a->sprite = new hgeSprite(hge->Texture_Load("media/army_s2.png"), 0xF, 0xF, float(TILE_W), float(TILE_H)); // implement the resource manager					add(a);				}


over to a script file.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.