public Script(IScriptable owner, LuaEnv luaEnv, string scriptId) { string ownerId = owner.rid.Replace('@', '_'); this._scriptEnv = luaEnv.NewTable(); this._scriptEnv.Set("owner", owner); luaEnv.Global.Set(ownerId, this._scriptEnv); scriptId = Defs.GetScript(scriptId); if (!string.IsNullOrEmpty(scriptId)) { scriptId = scriptId.Replace("[T]", ownerId); luaEnv.DoString(scriptId); } }